我试图在vba中提取字符串的最后两个单词。
是的,有人可以帮助我吗?非常感谢你!
答案 0 :(得分:6)
考虑:
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