我找到了以下脚本:
Sub Sample()
Dim ws As Worksheet
Dim lRow As Long
Set ws = ThisWorkbook.Sheets("Template Allocation")
With ws
lRow = .Range("V8" & .Rows.Count).End(xlUp).Row
.Range("V8:V" & lRow).NumberFormat = "dd/mm/yyyy"
End With
End Sub
但是有语法错误,我找不到,请帮助我。
答案 0 :(得分:2)
只需将"V8" & .Rows.Count
更改为"V8:V" & .Rows.Count
With ws
lRow = .Range("V8:V" & .Rows.Count).End(xlUp).Row
.Range("V8:V" & lRow).NumberFormat = "dd/mm/yyyy"
End With