你好,我需要在工作表顶部输入每个星期一、星期二和星期四的日期,以用作登记表,我查看了下面的表格,这个表格适用于两天,你能帮我把它延长到一周三天吗?我使用的是 Excel 2010。非常感谢
答案1
如果你想要周一、周二和周五(不是星期四)然后尝试这个简短的宏:
Sub DateMaker()
Dim d As Date, K As Long, fmt As String
K = 1
d = CDate(Now)
For i = 1 To Columns.Count
fmt = Format(d, "dddd")
If fmt = "Monday" Or fmt = "Tuesday" Or fmt = "Friday" Then
Cells(1, K).Value = d
K = K + 1
End If
d = d + 1
Next i
Rows(1).Cells.NumberFormat = "ddd d/m/yyyy"
End Sub
一切从今天开始。