I need an Excel VB script to remove all letter a-z A-z and () from cell.
I want to keep all numbers and periods (.).
For example SDF dsfsd dfS SD ( dfd ))) sdf 2.1 mg uf g will become 2.1
This is what I have but it is not working:
Function strClean(strtoclean)
Dim objRegExp, outputStr
Set objRegExp = New Regexp
objRegExp.IgnoreCase = True
objRegExp.Global = True
objRegExp.Pattern = "(([0-9]).)"
outputStr = objRegExp.Replace(strtoclean, "-")
objRegExp.Pattern = "-+"
outputStr = objRegExp.Replace(outputStr, "-")
strClean = outputStr
End Function
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…