2016-02-14 66 views

回答

0

請試試這個公式=MID(A1,FIND("/",A1)+1,LEN(A1)-FIND("/",A1))

+0

感謝您的回覆。我使用了下面的公式,但有沒有相同的公式可以刪除它。 http://stackoverflow.com/questions/34677235/how-to-insert-numbers-before-every-word-in-excel – Hsb

0

試試這個代碼:

Sub Test() 

Dim CL As Range, CLv As String, a As Long 

    For Each CL In ActiveSheet.UsedRange 
    CLv = CL.Value 
    On Error Resume Next 
    a = WorksheetFunction.Search("/", CLv) 
    On Error GoTo 0 
    If a <> 0 Then 
    CL.Value = Right(CLv, Len(CLv) - a) 
    a = 0 
    End If 
    Next 

End Sub 

編輯

或本規範(僅當單元格的值以數字開頭刪除):

Sub Test2() 

Dim CL As Range, CLv As String, a As Long 

    For Each CL In ActiveSheet.UsedRange 
    CLv = CL.Value 
    a = InStr(1, CLv, "/") 

    If a <> 0 Then 
     If IsNumeric(Left(CLv, a - 1)) Then 
     CL.Value = Right(CLv, Len(CLv) - a) 
     End If 
    End If 
    Next 

End Sub 
+0

輝煌。這是工作。非常感謝 – Hsb

+0

@Hsb,不客氣。 – Fadi