以下 Split 函数中的 (0) 是什么意思?

瓦利德

我正在使用下面的代码来获取最后一列字母。
它工作正常,但我不明白究竟是什么(0)意思!
根据MS文档和代码intellisense,它应该是Limit as integer
但在这种情况下,它应该像所有其他参数一样位于Split函数本身的括号内

Dim lastCol_L As String
lastCol_L = Split(Cells(1, lastCol_n).Address(True, False), "$")(0)

lastCol_n是来自其他代码的整数感谢所有有用的答案

杰里米汤普森

我不明白 (0) 到底是什么意思!

它是数组的第一项。让我向您展示一种更正统的方式:

Dim lastCol_L As String
'an array of strings
Dim arr() as String
'split the cell by $ sign into an array of strings
arr = Split(Cells(1, lastCol_n).Address(True, False), "$")
'the first item of the array
lastCol_L = arr(0)

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章