- ©«¤l
- 1446
- ¥DÃD
- 40
- ºëµØ
- 0
- ¿n¤À
- 1470
- ÂI¦W
- 0
- §@·~¨t²Î
- Windows 7
- ³nÅ骩¥»
- Excel 2010 & 2016
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW
- µù¥U®É¶¡
- 2020-7-15
- ³Ì«áµn¿ý
- 2024-10-21
|
¦^´_ 11# cypd
ÁÂÁ«e½ú
«á¾Ç§zÔ¬§]´Çªº¾Ç²ß·Q¥²§xÂZ¦U¦ì¤F,ÁÂÁ½׾ªº¥]®e,ÁÂÁ¦U¦ì«e½ú«ü±Ð
«á¾Çq¥¿¦p¤Uªº¾Ç²ß¤è®×¤ß±oµù¸Ñ,½Ð«e½ú°Ñ¦Ò
Option Explicit
Sub TEST_2()
Dim Brr, i&, Y%, M%, D1 As Date, D2 As Date, N%
'¡ô«Å§iÅܼÆ
Y = [AH1] + 1911: M = [AH2]: D1 = Y & "/" & M & "/" & "1"
'¡ô¥OYÅܼƬO [AH1]Àx¦s®æÈ+1911,
'¥OMÅܼƬO [AH2]Àx¦s®æÈ,
'¥OD1³o¤é´ÁÅܼƬO ¦è¤¸¦~/¤ë/1
Y = IIf(M = 12, Y + 1, Y): M = IIf(M = 12, 1, M + 1)
'¦pªG¤ë¥÷¬O12,´N¥O¦~¤À+1,
'¦pªG¤ë¥÷¬O12,´N¥O¤ë¥÷¬O 1¤ë,§_«h´N±N¤ë¥÷+1,
'³o¬On³B¸Ì¸ó¦~¿ë»{12¤ë³Ì«á¤@¤Ñ
D2 = Y & "/" & M & "/" & "1": D2 = D2 - 1
'¡ô¥OD2³o¤é´ÁÅܼƬO ¦è¤¸¦~/¤ë/1 (D2¬O¤UӤ몺²Ä1¤Ñ)
With [A4:B65]
'¡ô¥H¤U¬OÃö©óÀx¦s®æªºµ{§Ç
.ClearContents: Brr = .Value
'¡ô²M°£Àx¦s®æ¤º®e
.FormatConditions.Delete
'¡ô§R°£®æ¦¡¤Æ±ø¥ó
.Interior.ColorIndex = xlNone
'¡ô¥OÀx¦s®æ©³¦â¬O µL¦â
For i = 0 To (D2 - D1)
'¡ô³]¶¶°j°é
Brr(i * 2 + 1, 1) = D1 + N: Brr(i * 2 + 1, 2) = Right(Format(D1 + N, "aaa"), 1)
'¡ô¥O¤é´Á»P¬P´Á¼g¤JBrr°}¦C¸Ì
If InStr("¤»¤é", Brr(i * 2 + 1, 2)) Then Cells(i * 2 + 4, "B").Interior.ColorIndex = 38
'¡ô¥O§Y±N¬O¬P´Á¤»¤éªºÀx¦s®æ©³¦â¥ýÅܬ°®ç¬õ¦â
N = N + 1
'¡ô¥ONÅܼƲ֥[ 1
Next
.Value = Brr
'¡ô¥OBrr°}¦Cȼg¤JÀx¦s®æ¤¤
End With
End Sub |
|