VBA 文字格式轉時間
Sub ModDateFormat()
aStartRow = 3
aLastRow = Range("N65535").End(xlUp).Row
For i = aStartRow To aLastRow
'abcde = Cells(i, "N")
'做 N 欄
nn = Split(Cells(i, "N"), " ")
Cells(i, "N") = DateValue(nn(0)) + TimeValue(nn(1) & nn(2))
'做 O 欄
oo = Split(Cells(i, "O"), " ")
Cells(i, "O") = DateValue(oo(0)) + TimeValue(oo(1) & oo(2))
Next i
Columns("F:F").Select
Selection.NumberFormatLocal = "yyyy/m/d"
Columns("N:O").Select
Selection.NumberFormatLocal = "yyyy/m/d h:mm;@"
Range("A3").Select
End Sub
沒有留言:
張貼留言