Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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

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

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

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)
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading