- ©«¤l
- 5923
- ¥DÃD
- 13
- ºëµØ
- 1
- ¿n¤À
- 5986
- ÂI¦W
- 0
- §@·~¨t²Î
- win10
- ³nÅ骩¥»
- Office 2010
- ¾\ŪÅv
- 150
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW°ò¶©
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2022-1-23
|
¦^´_ 9# a703130
³o¨Ç¤]¥i¸Õ¸Õ¬Ý- Option Explicit
- Sub Ex()
- Dim AR(1), i As Integer, ii As Integer, s As String
- With Range([B1], [B1].End(xlDown)) '¸ê®Æ½d³ò
- AR(0) = .Value '¸ê®Æ¸m¤J°}¦C
- .Replace "*x", "", LookAt = xlPart '¤£nªº¸ê®Æ¨ú¥N¬°""¦r¦ê
- AR(1) = .Value '¾ã²z«áªº¸ê®Æ¸m¤J°}¦C
- .Value = AR(0) 'ÁÙì쥻¸ê®Æ
- For i = 1 To UBound(AR(1)) '¾ã²z«áªº¸ê®Æªº°}¦C
- s = "" '²MªÅ¦r¦êÅܼÆ
- For ii = Len(AR(1)(i, 1)) To 1 Step -2 '¥Ñ¦r¦ê§ÀºÝ
- s = s & "-" & Mid(AR(1)(i, 1), ii - 1, 2) '¨ú¤G¦r¤¸¸m¤J¦r¦êÅܼÆ
- Next
- AR(1)(i, 1) = Mid(s, 2) '°}¦Cªº¤¸¯À=¦r¦êÅܼÆ
- Next
- .Offset(, 1) = AR(1) '¸ê®Æ½d³ò¦V¥k¦ì²¾¤@Äæ½d³ò¸ê®Æ=AR(1)
- End With
- End Sub
- Sub Ex1()
- Dim AR, i As Integer, ii As Integer, xi As Variant, s As String
- With Range([B1], [B1].End(xlDown)) '¸ê®Æ½d³ò
- AR = .Value '¸ê®Æ¸m¤J°}¦C
- For i = 1 To UBound(AR)
- xi = InStr(AR(i, 1), "x") + 1 '°}¦Cªº¤¸¯À¤¤´M§ä"x"
- xi = Mid(AR(i, 1), xi) '¨ú±o¥¿½T¸ê®Æ
- s = "" '²MªÅ¦r¦êÅܼÆ
- For ii = Len(xi) To 1 Step -2 '¥Ñ¦r¦ê§ÀºÝ
- s = s & "-" & Mid(xi, ii - 1, 2) '¨ú¤G¦r¤¸¸m¤J¦r¦êÅܼÆ
- Next
- AR(i, 1) = Mid(s, 2) '°}¦Cªº¤¸¯À=¦r¦êÅܼÆ
- Next
- .Offset(, 1) = AR '¸ê®Æ½d³ò¦V¥k¦ì²¾¤@Äæ½d³ò¸ê®Æ=AR
- End With
- End Sub
- Sub Ex2()
- Dim AR, i As Integer, ii As Integer, s As String
- With Range([B1], [B1].End(xlDown)) '¸ê®Æ½d³ò
- AR = .Value '¸ê®Æ¸m¤J°}¦C
- For i = 1 To .Cells.Count '¸ê®Æ½d³òªº²Ä¤@ÓÀx¦s®æ¨ì³Ì«á¤@ÓÀx¦s®æ
- ii = Len(.Cells(i)) 'pºâÀx¦s®æªº¦r¤¸¼Æ
- s = "" '²MªÅ¦r¦êÅܼÆ
- Do
- s = s & "-" & Mid(.Cells(i), ii - 1, 2) '¨ú¤G¦r¤¸¸m¤J¦r¦êÅܼÆ
- ii = ii - 2 '¥Ñ«á©¹«e±À¶i2¦r¤¸
- Loop Until InStr(Mid(.Cells(i), ii - 1, 2), "x") 'Â÷¶}°j°é±ø¥ó:§ä¨ì¤£nªº¦r¦ê
- AR(i, 1) = Mid(s, 2) '°}¦Cªº¤¸¯À=¦r¦êÅܼÆ
- Next
- .Offset(, 1) = AR '¸ê®Æ½d³ò¦V¥k¦ì²¾¤@Äæ½d³ò¸ê®Æ=AR
- End With
- End Sub
½Æ»s¥N½X |
|