【问题标题】:Need Macro for finding text inside the cell using excel需要使用 excel 在单元格内查找文本的宏
【发布时间】:2017-06-05 04:56:42
【问题描述】:

我需要一个宏或公式来查找单元格中的字母,请按需要完成。

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

我必须在excell中整理出字母和“-”(Hypens)。

寻找你的答案....

【问题讨论】:

  • 需要更多的东西,如果你已经标记了 VBA,你应该尝试一些代码并首先在这里发布你尝试过的内容。您能否提供数据和预期结果的屏幕截图?

标签: excel excel-formula vba


【解决方案1】:

可能有很多方法可以实现这一点。这是一个简单的蛮力方法,很容易修改。虽然从技术上讲,它找不到字母字符,但它会使数字消失。

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-01-11
    • 1970-01-01
    • 2021-12-09
    相关资源
    最近更新 更多