jcv*_*jcv 15 string excel vba excel-vba
我正在尝试将字符串内容删除到字符串中包含的某个单词.例如
"Emily has wild flowers. They are red and blue."
我想使用VBA来替换它
"They are red and blue."
即删除所有内容直到单词"他们".我不知道字符串内容和其中包含的字符数.
我不知道该怎么做,我真的很感谢你的帮助!
S N*_*ash 15
干得好:
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)