- 帖子
- 26
- 主題
- 2
- 精華
- 0
- 積分
- 52
- 點名
- 0
- 作業系統
- Mac OS X
- 軟體版本
- Office 2010
- 閱讀權限
- 20
- 性別
- 男
- 註冊時間
- 2010-8-13
- 最後登錄
- 2010-10-29
|
每月第二個禮拜一,我是用算的,提供給您參考。
Sub nn()
Dim startdate As Date
Dim temp As Date
startdate = "2010/1/1"
currentmonth = 1
startcell = 1
Dim firstMonday As Boolean
firstMonday = False
For i = 0 To 365
temp = startdate + i
If currentmonth <> Month(temp) Then
GoTo forend
End If
If Weekday(temp, vbMonday) = 1 Then
If firstMonday = False Then
firstMonday = True
GoTo forend
End If
Cells(startcell, 1) = temp
startcell = startcell + 1
firstMonday = False
currentmonth = currentmonth + 1
End If
forend:
Next
End Sub |
|