- ©«¤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-3
|
¥»©«³Ì«á¥Ñ Andy2483 ©ó 2023-12-13 12:51 ½s¿è
ÁÂÁ½׾Â,ÁÂÁ¦U¦ì«e½ú
«á¾ÇÂǦ¹©«²M·¡°}¦C¯Á¤Þ¸¹³W«h,¾Ç²ß¤è®×¤U,½Ð¦U¦ì«e½ú«ü±Ð
°õ¦æ«e:
[F1].Resize(UBound(Crr) , 3) = Crr:
[F1].Resize(UBound(Crr) + 1, 3) = Crr:
Option Explicit
Sub TEST()
Dim Brr, Crr, Q, i&
'¡ô«Å§iÅܼÆ
Brr = Range([A2], [A65536].End(3))
'¡ô¥OBrrÅܼƬO±a¤JÀx¦s®æȪº¤Gºû°}¦C
ReDim Crr(UBound(Brr), 1 To 3)
'¡ô«Å§iCrrÅܼƬO ¤GºûªÅ°}¦C,Áa¦V¯Á¤Þ¸¹±q 0 ¨ì Brr°}¦C³Ì¤j¯Á¤Þ¦C¸¹,
'UBound(Brr) ¦P 0 To UBound(Brr) ,0 To ¥i¥H¬Ù²¤
'¾î¦V¯Á¤ÞÄ渹±q 1 ¨ì 3
Q = [{"t","W","L"}]
'¡ô¥OQÅܼƬO¤@ºû°}¦C,Q(1)="t",Q(2)="W",Q(3)="L"
'=[{~}]³o¼Ë¤è¦¡ªº¤@ºû°}¦C¨S¦³0¯Á¤Þ¸¹
'Q = Array("t", "W", "L"):³o¼Ë¤è¦¡ªº¤@ºû°}¦C¦³0¯Á¤Þ¸¹
Crr(0, 1) = Q(1): Crr(0, 2) = Q(2): Crr(0, 3) = Q(3)
'¡ô¦¹Crr°}¦C0¯Á¤Þ¸¹¦C¬O¥Î¨Ó©ñ¼ÐÃD¦C,³o¼Ëªº¤è¦¡¸û¤£·|¼vÅT°j°éªº³]p,
'°j°é¼Æ ·½ÀY°}¦C¸ê®Æ¹ï»ô¦P¤@Ó °j°é¼Æ µ²ªG°}¦C¸ê®Æ
For i = 1 To UBound(Brr)
'¡ô³]¶¶°j°é±N¸ê®Æ¼g¤Jµ²ªG°}¦C¸Ì
If Not Brr(i, 1) Like "*t#*W#*L#*" Then GoTo i01
Crr(i, 1) = Val(Split(Brr(i, 1), Q(1))(1))
Crr(i, 2) = Val(Split(Brr(i, 1), Q(2))(1))
Crr(i, 3) = Val(Split(Brr(i, 1), Q(3))(1))
i01: Next
[F1].Resize(UBound(Crr) + 1, 3) = Crr
'¡ô¥Oµ²ªG°}¦C¼g¤JÀx¦s®æ¸Ì,
'UBound(Crr) + 1 ,³o+1ªºì¦]¬OResize()ÂX®iÁa¦V¾î¦VÀx¦s®æ½d³ò,·Ó²ßºD¬O¦P°}¦C³Ì¤j¯Á¤Þ¸¹½d³ò,
'¦ý¬OCrr°}¦C¦³0¯Á¤Þ¸¹,¥BUBound(Crr)¬OCrr°}¦C³Ì¤j¯Á¤Þ¦C¸¹,©Ò¥H¥²¶·+1 :
'¶K¤JÀx¦s®æªº¤è¦¡¬O¥H°}¦Cªº³Ì¥ª¤W¨¤¸ê®Æ¶}©l¦V¤U/¦V¥k©Ò»Ý½d³ò¶K¤JÀx¦s®æ,
'³Ì¥ª¤W¨¤°}¦C¶}©l¯Á¤Þ¸¹¬O(1,1),´N±q (1,1)°}¦Cªº³Ì¥ª¤W¨¤¸ê®Æ¶}©l¤U/¥k¼g¤J
'³Ì¥ª¤W¨¤°}¦C¶}©l¯Á¤Þ¸¹¬O(0,1),´N±q (0,1)°}¦Cªº³Ì¥ª¤W¨¤¸ê®Æ¶}©l¤U/¥k¼g¤J
'©Ò¥HCrr°}¦C¦³0¯Á¤Þ¦C¸¹,´N¥²¶·¥H°}¦C³Ì¤j¦C¸¹+1ªºÀx¦s®æ½d³ò¼g¤JÀx¦s®æ¤¤,¤~·|§¹¾ã
End Sub
PS:°}¦C¸Ì¦³¨S¦³(0,0) (1,0) (0,1)³o¨Ç¯Á¤Þ¸¹,¥þ¾Ì¨ä«Å§i
1.ReDim Crr(100,100) ¦P ReDim Crr(0 To 100,0 To 100) ,¯Á¤Þ¸¹¬O±q0¶}©l,
¦pªG©Ò·Qnªº¶}©l¯Á¤Þ¸¹Áa¦V¾î¦V³£n±q1¶}©l,´N¥²¶·ReDim Crr(1 To 100,1 To 100)
2.Brr = Range([A1], [A65536].End(3))
¥OBrrÅܼƬO±a¤JÀx¦s®æȪº¤Gºû°}¦C,³o¼Ëªº¤Gºû°}¦C,¨ä°}¦C¯Á¤Þ¸¹±q(1,1)¶}©l,¦Ó¥B¨S¦³(0,0) (1,0) (0,1)³o¨Ç¯Á¤Þ¸¹ |
|