- ©«¤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
|
¥»©«³Ì«á¥Ñ Andy2483 ©ó 2023-6-26 07:49 ½s¿è
¦^´_ 3# abc9gad2016
ÁÂÁ«e½ú¦^´_,Åwªï«e½ú±`¤W½×¾Â¤@°_¾Ç²ß
¥H¤U¬O¤µ¤Ñ«á¾Ç½Æ²ßªº¤ß±oµù¸Ñ,½Ð«e½ú°Ñ¦Ò,½Ð¦U¦ì«e½ú«ü±Ð
Option Explicit
Sub TEST()
Dim Brr, Crr, V&, i&, R, N&, S%
'¡ô«Å§iÅܼÆ(&¬Oªø¾ã¼Æ,%¬Oµu¾ã¼Æ,¨S¦³±a²Å¸¹ªº¬O³q¥Î«¬ÅܼÆ)
Brr = Range([§Ç¸¹·s¼W!Q3], [§Ç¸¹·s¼W!M65536].End(xlUp))
'¡ô¥OBrrÅܼƬO ¤Gºû°}¦C,¥HM~QÄæÀx¦s®æȱa¤J°}¦C¤¤
ReDim Crr(1 To 60000, 1 To 11)
'¡ô¥OCrrÅܼƬO ¤GºûªÅ°}¦C,Áa¦V½d³ò1~6¸U¯Á¤Þ¸¹,¾î¦V½d³ò1~11¯Á¤Þ¸¹
For i = 1 To UBound(Brr)
'¡ô³]¶¶°j°é,i±q1¨ìBrr°}¦CÁa¦V³Ì¤j¯Á¤Þ¦C¸¹
S = IIf(Brr(i, 2) <= Brr(i, 3), 1, -1)
'¡ô¥OSÅܼƬO 1©Î -1
For R = Val(Brr(i, 2)) To Val(Brr(i, 3)) Step S
'¡ô³]¶¶°j°é,R±qBrr°}¦CÈ(§Ç¸¹-«e¨ì §Ç¸¹-«á),°j°é¯Å¶Z¬O SÅܼÆ
V = V + 1
'¡ô¥OVÅܼƲ֥[1 (³o¬On°O¿ý²Öpªº°}¦C¯Á¤Þ¦C¸¹)
N = N + 1
'¡ô¥ONÅܼƲ֥[1 (³o¬On²Öp¶µ¦¸Ä檺¶µ¦¸)
Crr(V, 1) = N
'¡ô¥OCrr°}¦C(²Öpªº°}¦C¯Á¤Þ¦C¸¹,²Ä1Äæ)°}¦CȬO NÅܼÆ
Crr(V, 3) = Brr(i, 1)
'¡ô¥OCrr°}¦C(²Öpªº°}¦C¯Á¤Þ¦C¸¹,²Ä3Äæ)°}¦CȬO ,
'¬Oi°j°é²Ä1ÄæBrr°}¦CÈ(¾÷ºØ)
Crr(V, 4) = R
'¡ô¥OCrr°}¦C(²Öpªº°}¦C¯Á¤Þ¦C¸¹,²Ä4Äæ)°}¦CȬO R°j°é¼Æ
Crr(V, 11) = Brr(i, 5)
'¡ô¥OCrr°}¦C(²Öpªº°}¦C¯Á¤Þ¦C¸¹,²Ä11Äæ)°}¦CȬO (ª©¥»)
Next
N = 0
'¡ô¥ONÅܼÆÂk¹s (¶µ¦¸Âk¹s)
Next
If V = 0 Then Exit Sub
'¡ô¥O¦pªG¨S¦³¸ê®Æ´Nµ²§ôµ{¦¡°õ¦æ
Sheets("§Ç¸¹·s¼W").UsedRange.Offset(5, 0).Delete
'¡ô¥O¸ê®Æ§R°£
With Sheets("§Ç¸¹·s¼W").[A6].Resize(V, 11)
'¡ô¥H¤U¬OÃö©ó±q[A6]Àx¦s®æ¶}©lÂX®i¥²nÀx¦s®æ½d³òªºµ{§Ç
.Value = Crr
'¡ô¥OÀx¦s®æȬO Crr°}¦CÈ
With .Columns(6)
'¡ô¥H¤U¬O³o½d³òÀx¦s®æ²Ä6Ä檺µ{§Ç
.Value = "=IF(E6="""","""",RIGHT(E6,5)-RIGHT(D6,5)+1)"
'¡ô¥O³o²Ä6ÄæȬO ¤½¦¡~~ (PS:¥unµ¹²Ä1¦Cªº¤½¦¡,EXCEL·|¦Û°Ê¤U¨ê)
End With
Application.Goto .Item(6)
End With
Erase Brr, Crr
'¡ô¥OÄÀ©ñÅܼÆ
End Sub |
|