需要宏来使用excel在单元格内查找文本

时间:2017-01-20 08:59:54

标签: excel-vba excel-formula vba excel

我需要一个宏OR公式来查找单元格中的字母,请做必要的。

输入输出 521.03S S. 522.05KS KS 520.32-EXS -EXS 03.200.01-ABC -ABC

我必须理清alphepets和“ - ”(Hypens)在excell。

寻找你的答案......

1 个答案:

答案 0 :(得分:0)

可能有很多方法可以实现这一目标。这是一种简单,强力的方法,易于修改。虽然从技术上讲,它没有找到字母字符,但它会使数字消失。

Function noNumbers(ByVal cltext As String) As String

Dim mytext As String
mytext = Replace(cltext, "0", "")
mytext = Replace(mytext, "1", "")
mytext = Replace(mytext, "2", "")
mytext = Replace(mytext, "3", "")
mytext = Replace(mytext, "4", "")
mytext = Replace(mytext, "5", "")
mytext = Replace(mytext, "6", "")
mytext = Replace(mytext, "7", "")
mytext = Replace(mytext, "8", "")
mytext = Replace(mytext, "9", "")
noNumbers = mytext

End Function