2014-12-19 55 views
2

我有下面的一些代碼查找的任何變化,並認爲對其他片上​​的匹配,並且更新的任何變化,但是日期轉出時去從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 
+1

我可能會忽略,但我看不出有任何的日期格式件在代碼中。能否請你澄清? – Alex

+1

嘗試自定義格式接收單元(VBA沒有必要爲這個)。 – pnuts

+0

你有Excel中設置要定位到英國? – guitarthrower

回答