I'm trying to extract the last two words of a string in vba.
我试图在vba中提取字符串的最后两个单词。
can anyone help me with that one please?
有人可以帮助我吗?
thank you a lot!
非常感谢!
1 个解决方案
#1
6
Consider:
Sub LastTwoWords()
Dim s As String
s = "Now is the time for all good men to come to the aid of the party"
ary = Split(s, " ")
MsgBox ary(UBound(ary) - 1)
MsgBox ary(UBound(ary))
End Sub
#1
6
Consider:
Sub LastTwoWords()
Dim s As String
s = "Now is the time for all good men to come to the aid of the party"
ary = Split(s, " ")
MsgBox ary(UBound(ary) - 1)
MsgBox ary(UBound(ary))
End Sub