- ©«¤l
- 1447
- ¥DÃD
- 40
- ºëµØ
- 0
- ¿n¤À
- 1471
- ÂI¦W
- 0
- §@·~¨t²Î
- Windows 7
- ³nÅ骩¥»
- Excel 2010 & 2016
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW
- µù¥U®É¶¡
- 2020-7-15
- ³Ì«áµn¿ý
- 2024-12-5
|
¥»©«³Ì«á¥Ñ Andy2483 ©ó 2023-5-15 08:28 ½s¿è
¦^´_ 9# cypd
ÁÂÁ«e½ú¦^´_,¤@°_¾Ç²ß
«á¾Ç¤µ¤Ñ½Æ²ß³o©«,¤è®×¾Ç²ß¤ß±oµù¸Ñ¦p¤U,½Ð«e½ú°Ñ¦Ò
Option Explicit
Sub TEST_2()
Dim Brr, i&, Y%, M%, D1 As Date, D2 As Date
'¡ô«Å§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¤Ñ)
'¡ô¥OD2ÅܼƬO¦Û¨¤é´Áªº«e¤@¤Ñ(¤]´N¬O¤WӤ몺³Ì«á¤@¤Ñ)
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 + i + 1: Brr(i * 2 + 1, 2) = Right(Format(D1 + i + 1, "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®æ©³¦â¥ýÅܬ°®ç¬õ¦â
Next
.Value = Brr
'¡ô¥OBrr°}¦Cȼg¤JÀx¦s®æ¤¤
End With
End Sub |
|