Home > OS >  What is (0) means on the below Split function?
What is (0) means on the below Split function?

Time:06-03

I am using the below code to get the last column letter.
It works correctly, but I do not understand what is (0) means exactly !
According to MS documentation and code intellisense, it should be the Limit as integer
But in this case it should be inside the brackets of Split function itself like all the rest arguments

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

lastCol_n is integer from other code Thanks for all helpful answer

CodePudding user response:

I do not understand what is (0) means exactly !

It's the First item of the Array. Let me show you a more orthadox way:

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)
  • Related