Option Explicit Sub MyMacro() MsgBox ExtractDigits("601A50B300") End Sub Function ExtractDigits(StrInput As String) As String Dim intLen As Integer Dim i As Integer Dim strTl As String, strT2 As String intLen = Len(StrInput) If intLen > 0 Then For i = 1 To intLen strTl = Mid(StrInput, i, 1) If strTl = "0" Then strT2 = strT2 & strTl Else strTl = Val(Mid(StrInput, i, 1)) If strTl > 0 Then strT2 = strT2 & strTl End If Next End If ExtractDigits = strT2 End Function