ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

½Ð°Ý¬°¦ó¦bexcel 2010¤¤µLªk°õ¦æ

½Ð°Ý¬°¦ó¦bexcel 2010¤¤µLªk°õ¦æ

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&
%0

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)

TOP

©êºpÀ³¸Ó¬O§Úªí¹Fªº¤£°÷²M·¡¡A¤£ª¾¬°¦ó³o¬qµ{¦¡½X¦bexcel 2003®É¹B§@ªº«Ü¶¶ºZ¡A¦ý¬O¤½¥q³Ìªñ§ó·s¬°excel 2010®É¦­´Á¦³¨Ï¥Î¨ìvbaªºÀɮצ³¨Ç´N¤£¯à°õ¦æ¤F¡A¤ñ¦p¤W­±ªºÀɮצb°õ¦æ¨ìFor i = 2 To [M65536].End(xlUp).Row  ´NÅã¥Ü¿ù»~16 ªí¥Ü¹Bºâ¤Ó½ÆÂø¡A¤£ª¾¬O§_¦]ª©¥»ªº°ÝÃD³y¦¨ªº¶Ü¡A¦³§_¸Ñ¨Mªº¤è¦¡©O?¦A¦¸·PÁ¤j®aªºÀ°¦£«ü±Ð

TOP

¦^´_ 3# h60327
§Ú²q¦³¥i¯à¬O 65536 ¦C¸¹¶W¹L¨t²Î®e³\ªº¦C¸¹,
¸Õ¸Õ±N [M65536] §ï¦¨ Cells(Rows.Count, 13)
¨ä¾l¤ñ·Ó³B²z.

Cells®æ¦¡ :
Cells(¦C¸¹, Ä渹) = [Äæ¦W¦C¸¹]

TOP

·PÁÂluhpro¥ý¶iªº«ü¾É¡A¹Bºâ¦¡²×©ó¥i¥H©¹¤U¶]¡A¦ý°õ¦æ¨ìFor i = [k1] To DateAdd("yyyy", 1, [k1]) - 1³o¤@¦æ®É¤Sµo¥Í°ÝÃD¤F¤´µM¬O¿ù»~16 ¹Bºâ¤Ó½ÆÂø¡A¦]¬°¬OÄÝ©ó¤é´Á¹Bºâ¡A¤£ª¾­n¦p¦ó­×¥¿¡AÁٽЦU¦ì¥ý¶i¯à¤©«ü¾É¡A«D±`·PÁÂ

TOP

§âFor i = [k1] To DateAdd("yyyy", 1, [k1]) - 1
§ï¦¨For i = [k1] To DateAdd("yyyy", 1, Cells(1, 11).Value) - 1
´N¹B§@¥¿±`¤F¡A¥u¬O¤£ª¾­ì¦]¬°¦ó¡C

TOP

¦^´_ 6# h60327
i ªº«Å§i  i# §ï¬° i& ¬Ý¬Ý

TOP

³o¤Ó¯«©_¤F¡A¦ý¬°¤°»ò©O

TOP

        ÀR«ä¦Û¦b : µoµÊ®ð¬Oµu¼ÈªºµoºÆ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD