提供一个VBA自定义函数。
Function snums(cel) '提取字符串中的数字
Application.Volatile
For i = 1 To Len(cel)
st = Mid(cel, i, 1)
If IsNumeric(st) Then
strNum = strNum & st
End If
Next
snums = strNum
End Function
Function snumt(cel) '提取字符串中的文本
Application.Volatile
For i = 1 To Len(cel)
st = Mid(cel, i, 1)
If Not IsNumeric(st) Then
strNum = strNum & st
End If
Next
snumt = strNum
End Function