ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] ¼Æ¦r»P¼Æ¦r¤¤¦pªG¦³ªÅ®æ ­n¦p¦ó¨ú¥N©Î§R°£©O?

¬Ý°_¨Ó³£¬O¤d¤À¦ì«á­±ªº¤T¦ì¼Æ¦r¦h¤@­ÓªÅ¥Õ¦r¤¸,
¦Û­q¨ç¼Æ:

¤½¦¡¡G=ClearSpace(A2)
¡@
¡@
­ã´£³¡ªL µoªí©ó 2016-8-29 11:43



    ¬Ý¨Óª©¤j¦n¹³¬O¨Ï¥Î¥¿«hªí¹F¦¡¨Ó¸Ñ¨M³o­Ó°ÝÃD¡A«Ü§Q®`¡I¦Ó¥B¤£»Ý­n¨Ï¥ÎCreateObject("VBScript.RegExp")·Pı§ó¤è«K¡C
¥¿«hªí¹F¦¡(http://regexr.com/)¦n¹³«Ü§xÃø¡A§Ú¬Ý¤F«Ü¦hªF¦è¤]¤£¤F¸Ñ¡A¤U­±¦³¤@ÃD¥Ø¡A¥i¥H½Ðª©¤jÀ°§U«ü±Ð¶Ü¡H

§Ú·Q§ä¥X³oºØ¥y«¬ªº¦r¦ê¡A­º1/2­Ó¦r¬°¼Æ¦r¡A¤§«á¥i¯à¬O¡u) ¡v¡B¡u. ¡vªº¤À®æ²Å¸¹©M¤@ªÅ¥Õ¦r¤¸¡A¤§«á¬O¤¤¤å¦r¡C¨Ò¦p¡G
-----------------------
²Å¦X
1) ³¯¤j¤å
32. ª`·N¨Æ¶µ

¤£²Å¦X
123) ¨ä¥L
Âø¶µ
----------------
¯à°÷¥Î¥¿«hªí¹F¦¡³B²z¶Ü¡H²{¦b§Ú¥u¯à¥Îfor loop ¡A¦A¥Îasc¡A«ÜºC......

TOP

¬Ý°_¨Ó³£¬O¤d¤À¦ì«á­±ªº¤T¦ì¼Æ¦r¦h¤@­ÓªÅ¥Õ¦r¤¸,
¦Û­q¨ç¼Æ:
  1. Function ClearSpace(xStr$) As String
  2. Dim TT, i%
  3. TT = Split(Replace(xStr, ",", "_,"), "_")
  4. For i = 0 To UBound(TT)
  5.     If TT(i) Like ",[0-9][0-9] [0-9]*" Then
  6.        TT(i) = Replace(TT(i), " ", "", 1, 1)
  7.     End If
  8. Next
  9. ClearSpace = Join(TT, "")
  10. End Function
½Æ»s¥N½X
Xl0000109.rar (40.52 KB)

¤½¦¡¡G=ClearSpace(A2)
¡@
¡@

TOP

¦^´_ 1# tr24572411
Sub Ex()
    With Sheets("Sheet2")
        For i = 1 To .Range("A" & Rows.Count).End(xlUp).Row
            '  .Cells(i, 6) = Trim(.Cells(i, 1)) = Trim(.Cells(i, 2))   '  ¦r¦ê¤¤¤§ Space¡@µLªk²¾°£
            .Cells(i, 7) = Replace(.Cells(i, 1), " ", "") = Replace(.Cells(i, 2), " ", "")
        Next
    End With
End Sub

TOP

¦^´_ 1# tr24572411

TOP

        ÀR«ä¦Û¦b : °ß¨ä´L­«¦Û¤vªº¤H¡A¤~§ó«i©óÁY¤p¦Û¤v¡C
ªð¦^¦Cªí ¤W¤@¥DÃD