excel - 在VBA中提取字符串的最后两个单词

标签 excel vba

我正在尝试在 vba 中提取字符串的最后两个单词。

有人可以帮我解决这个问题吗?

非常感谢!

最佳答案

考虑:

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

关于excel - 在VBA中提取字符串的最后两个单词,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37617429/

相关文章:

xml - 从 XML 文件中提取标签信息到 Excel 文件

excel - 在代码段上出现 "Argument not optional"错误

vba - vba中发生意外错误(类型不匹配和无效的过程,调用或参数)

vba - 检测单元格值是否确实通过编辑而更改

vba - VBA 宏中另存为位置的对话框

vba - 如何在同一工作表Excel VBA中复制列

string - Excel Vba 将字符串上的某些文本加粗

database - 如何使用vba插入getdate函数

excel - "@"符号在 Excel VBA 中的日期格式末尾意味着什么?

vba - Excel VBA 推荐