1、提取数字

Function sz(i As String) As String
    Dim regex As Object
    Set regex = CreateObject("VBScript.RegExp")
    regex.Pattern = "[^0-9]"
    regex.ignoreCase = False
    regex.Global = True
    sz = regex.Replace(i, "  ")
    Set regex = Nothing
End Function

 

用法:

Excel VBA提取数字_其他