Excel 使用中的格式粘贴值,因为日期格式每次都会更改
我正在尝试将日期值从“创建新客户”表复制到“客户数据”表,并且每次日期格式更改时都会复制Excel 使用中的格式粘贴值,因为日期格式每次都会更改,excel,vba,Excel,Vba,我正在尝试将日期值从“创建新客户”表复制到“客户数据”表,并且每次日期格式更改时都会复制 strName = Sheets("Create_New_Customer").Cells(14, 4).Value strAddress = Sheets("Create_New_Customer").Cells(15, 4).Value strTown = Sheets("Create_New_Customer").Cells(16, 4).Value strPostcode = Sheets("Cre
strName = Sheets("Create_New_Customer").Cells(14, 4).Value
strAddress = Sheets("Create_New_Customer").Cells(15, 4).Value
strTown = Sheets("Create_New_Customer").Cells(16, 4).Value
strPostcode = Sheets("Create_New_Customer").Cells(17, 4).Value
strTel = Sheets("Create_New_Customer").Cells(18, 4).Value
strEmail = Sheets("Create_New_Customer").Cells(19, 4).Value
strEqMk = Sheets("Create_New_Customer").Cells(20, 4).Value
strEqMdl = Sheets("Create_New_Customer").Cells(21, 4).Value
strEqType = Sheets("Create_New_Customer").Cells(22, 4).Value
strEqCost = Sheets("Create_New_Customer").Cells(23, 4).Value
strRentalStartDate = Sheets("Create_New_Customer").Cells(24, 4).Value
strCond = Sheets("Create_New_Customer").Cells(25, 4).Value
strPayT = Sheets("Create_New_Customer").Cells(26, 4).Value
strMonthRentalCost = Sheets("Create_New_Customer").Cells(27, 4).Value
strPaymentMehtod = Sheets("Create_New_Customer").Cells(28, 4).Value
With Sheets("CustomersData")
.Cells(LastRow, 2).Value = strName
.Cells(LastRow, 3).Value = strAddress
.Cells(LastRow, 4).Value = strTown
.Cells(LastRow, 5).Value = strPostcode
.Cells(LastRow, 6).Value = strTel
.Cells(LastRow, 7).Value = strEmail
.Cells(LastRow, 8).Value = strEqMk
.Cells(LastRow, 9).Value = strEqMdl
.Cells(LastRow, 10).Value = strEqType
.Cells(LastRow, 11).Value = strEqCost
.Cells(LastRow, 12).Value = strRentalStartDate
.Cells(LastRow, 13).Value = strCond
.Cells(LastRow, 14).Value = strPayT
.Cells(LastRow, 15).Value = strMonthRentalCost
.Cells(LastRow, 16).Value = strPaymentMehtod
End With
请告诉我们更多。。。我只看到一个日期栏,还有吗?strRentalStartDate请与我们分享您看到的一些日期格式。另外,对于每种输入日期格式,您希望输出哪种格式的日期?感谢您的检查,在“创建新客户”中,我输入日期并以MM、DD、YYY格式显示,当我提交在“CustomerData”表中创建记录时,它以美国格式显示并更改为“MM、DD、YYY”我希望它的格式与“创建新客户”中的格式相同,是的,它只是strrentalStartDate。在复制值之前,您可以复制数字格式。这两种日期格式似乎是相同的“MM,DD,YYY”。还是有输入错误?好的,让我们在移动它之后添加.Range(LastRow,12)。Numberformat=“dd,mm,yyyy”来强制它成为我们想要的