我在 L 列中从第 2 行开始到找到的最后一行有日期,我希望将格式更改为 dd mmmm yyyy。
有人知道如何编码吗? 先谢谢你了
请尝试一下。
Sub FormatDate()
Dim lastRow As Long, oSht As Worksheet
Set oSht = ActiveSheet ' modify as needed
lastRow = oSht.Cells(oSht.Rows.Count, "L").End(xlUp).Row
oSht.Range("L2:L" & lastRow).NumberFormatLocal = "dd mmmm yyyy"
End Sub
Sub ApplyDateFormat()
Dim ws As Worksheet: Set ws = ThisWorkbook.Sheets("Sheet1")
Dim rg As Range:
With ws.Range("L2")
With .Resize(ws.Cells(ws.Rows.Count, .Column).End(xlUp).Row - .Row + 1)
.NumberFormat = "dd mmmm yyyy"
' to force e.g. US format:
'.NumberFormat = "[$-409]dd mmmm yyyy"
End With
End With
End Sub