我正在尝试删除字符串内容,直至字符串中包含的某个单词。例如
"Emily has wild flowers. They are red and blue."
我想使用 VBA 来替换它
"They are red and blue."
即删除“他们”一词之前的所有内容。我不知道字符串内容以及其中包含的字符数。
我不知道如何执行此操作,非常感谢您的帮助!
最佳答案
给你:
Dim s As String
s = "Emily has wild flowers. They are red and blue."
Dim indexOfThey As Integer
indexOfThey = InStr(1, s, "They")
Dim finalString As String
finalString = Right(s, Len(s) - indexOfThey + 1)
关于string - Excel VBA - 删除最多*单词*的字符串内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18402931/