- ©«¤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
|
¦^´_ 7# ã´£³¡ªL
ÁÂÁ½׾Â,ÁÂÁ«e½ú«ü¾É
«á¾ÇÂǦ¹©«¾Ç¨ì¶¶°j°é¸Ì°fµÛ¶]µ²ªG,³o¬O«á¾Ç³o±e¤~±q¨S·Q¹Lªº,¾Ç²ß¤ß±o¦p¤U,½Ð«e½ú¦A«ü¾É
°õ¦æ«e:
°õ¦æµ²ªG:
Option Explicit
Sub TEST_A1()
Dim Arr, i&, j%, Vr, TR
'¡ô«Å§iÅܼÆ
Arr = Range([g1], [e65536].End(3))
'¡ô¥OArrÅܼƬO¤Gºû°}¦C,¥HÀx¦s®æȱa¤J
Vr = Array("000-", "0000-", "000")
'¡ô¥OVrÅܼƬO¤@ºû°}¦C
For i = 3 To UBound(Arr)
'¡ô³]¶¶°j°éi
TR = Split(Arr(i, 1) & "--", "-")
'¡ô¥OTRÅܼƬO¤@ºû°}¦C: Arr°}¦Cȳs±µ"--"¦¨¬°·s¦r¦ê«á,¦A¥H"-"¤À³Î¸Ó¦r¦ê¦¨
'(¯Á¤Þ¸¹¦Ü¤Ö·|¦³0~2)
For j = 0 To 2
'¡ô³]¶¶°j°éj
Arr(i - 2, 3 - j) = IIf(IsNumeric(TR(j)), Format(TR(j), Vr(j)), "")
'¡ô¥Oì¨ÓªºArr°}¦Cȱq²Ä1¦C¶}©l¼g¤J·s°}¦CÈ
'IIf():¦pªGIsNumeric(TR(j))ÅÞ¿èȬOTrue,´N¦^¶Ç Format(TR(j), Vr(j))¦r¦ê,
'§_«h¦^¶ÇªÅ¦r¤¸
'IsNumeric(TR(j)):TR°}¦Cªºj°j°é¼Æ¯Á¤Þ¸¹°}¦CȬO¤£¬O¼ÆÈ?? ¦^¶ÇTrue ©Î False
'Format(TR(j), Vr(j)):¥OTR°}¦Cªºj°j°é¼Æ¯Á¤Þ¸¹°}¦CÈÂà¤Æ¦¨
'Vr°}¦Cªºj°j°é¼Æ¯Á¤Þ¸¹°}¦CȳW«hªº®æ¦¡¦r¦ê
Next j
Next i
With [r3].Resize(UBound(Arr) - 2, 3)
'¡ô¥H¤U¬OÃö©ó[R3]Àx¦s®æÂX®i©Ò»Ý½d³òÀx¦s®æªºµ{§Ç
.NumberFormatLocal = "@"
'¡ô¥O¸Ó½d³òÀx¦s®æ®æ¦¡¬O ¤å¦r
.Value = Arr
'¡ô¥O¸Ó½d³òÀx¦s®æÈ¥HArr°}¦Cȱa¤J
End With
End Sub |
|