Excel VBA提取数字

 

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

 

用法:

 

posted @ 2020-03-13 13:39  行走的思想  阅读(2309)  评论(0编辑  收藏  举报