- ©«¤l
- 39
- ¥DÃD
- 11
- ºëµØ
- 0
- ¿n¤À
- 56
- ÂI¦W
- 0
- §@·~¨t²Î
- XP3
- ³nÅ骩¥»
- OFFICE 2003
- ¾\ŪÅv
- 20
- µù¥U®É¶¡
- 2010-5-7
- ³Ì«áµn¿ý
- 2023-3-22
|
Private Sub CommandButton1_Click()
[A2:H65536].ClearContents
Dim ds As Object, ds1 As Object, Arr(1 To 65536, 0 To 4), Men, i#, test$, k%, temp$, s&
Men = Range([J2], [J65536].End(xlUp)).Value
Set ds = CreateObject("Scripting.Dictionary") '°ê©w°²¤é
Set ds1 = CreateObject("Scripting.Dictionary") '¸É¤W¯Z
For i = 2 To [M65536].End(xlUp).Row '°ê©w°²¤é
temp = Month(Cells(i, 13)) & "," & Day(Cells(i, 13))
ds.Add temp, i
Next
For i = 2 To [O65536].End(xlUp).Row '¸É¤W¯Z
temp = Month(Cells(i, 15)) & "," & Day(Cells(i, 15))
ds1.Add temp, i
Next
For i = [k1] To DateAdd("yyyy", 1, [k1]) - 1
test = Month(i) & "," & Day(i)
If (Weekday(i, vbMonday) < 6 And ds.Exists(test) = False) Or ds1.Exists(test) = True Then '¶g¤@¦Ü¶g¤¨Ã¦©°£MÄæ°ê©w°²¤é¥[¤J¸É¤W¯Z¤é
s = s + 1
Arr(s, 1) = i
Arr(s, 2) = Month(i)
Arr(s, 3) = Day(i)
Arr(s, 4) = Weekday(i, 2)
k = IIf(s Mod UBound(Men) = 0, UBound(Men), s Mod UBound(Men))
Arr(s, 0) = Men(k, 1)
End If
Next
[A2].Resize(s, 5) = Arr
Range([E2], [E65536].End(xlUp)).FormulaR1C1 = _
"=IF(WEEKDAY(RC[-3])=2,""¤@"",(IF(WEEKDAY(RC[-3])=3,""¤G"",(IF(WEEKDAY(RC[-3])=4,""¤T"",(IF(WEEKDAY(RC[-3])=5,""¥|"",(IF(WEEKDAY(RC[-3])=6,""¤"",(IF(WEEKDAY(RC[-3])=7,""¤»"",(IF(WEEKDAY(RC[-3])=1,""¤é"","""")))))))))))))"
Range([E2], [E65536].End(xlUp)).Formula = Range([E2], [E65536].End(xlUp)).Value
End Sub
°õ¦æ¦ÜFor i = 2 To [M65536].End(xlUp).Row ´Nµo¥Í¿ù»~ |
-
-
123.rar
(17.11 KB)
|