>我在下面有一些代码来查找任何更改并在另一张纸上找到匹配项并更新任何更改,但是传输的日期从英国格式 dd/mm/yyyy 变为美式日期 mm/dd/yyyy,使工作表中的所有日期都不正确。
有人可以帮助和建议我如何使其保持原样吗?谢谢!
Dim s1rw As Long, s2rw As Long, col As Long, endcol As Long
Sheets("Sheet1").Select
With Sheets("Sheet2")
s2rw = 2 ' Adjust to first data row #
endcol = .Cells(s2rw - 1, 1).End(xlToRight).Column
Do Until .Cells(s2rw, 1).Value = "" ' Loop through case #s
s1rw = 0
On Error Resume Next
s1rw = Cells.Find(What:=.Cells(s2rw, 1).Value, LookIn:=xlFormulas, LookAt:=xlWhole).Row
On Error GoTo 0
If s1rw > 0 Then ' Found case #
For col = 1 To endcol ' Loop through columns
If Cells(s1rw, col).Value <> "" Then
.Cells(s2rw, col).Value = Cells(s1rw, col).Value
End If
Next
End If
Rows(s2rw).Delete
s2rw = s2rw + 1
Loop
.Select
End With
更改单元格格式的Range.NumberFormat()
方法将允许您在VBA代码中设置自己的自定义格式。 http://msdn.microsoft.com/en-us/library/office/ff196401%28v=office.15%29.aspx