问题:

一个月的工作日和日期将以二维数组形式打开,然后插入到工作表

中===答案:

将下面的代码放入标准模块中。

Sub dayarray()

Dim arrDay(1 To 31, 1 To 2) As Variant

Dim intCounter As Integer

For intCounter = 1 To 31

arrDay(intCounter, 2) = DateSerial(Year(Date), 12, intCounter)

arrDay(intCounter, 1) = Format(arrDay(intCounter, 2), "dddd")

Next intCounter

Range("A1:B31").Value = arrDay

End Sub