Home » excel » Excel VBA array length exceed a line and throwing error

Excel VBA array length exceed a line and throwing error

Posted by: admin May 14, 2020 Leave a comment

Questions:

I have declared following variable in excel VBA

>  Dim arrayCollabName as variant 
>  arrayCollabName = Array("Name1","Name2", ....."Name62")

But the Names inside the array are exceeding 1 line in VBA sheet and throwing error

Any suggestion on how to do this without error

How to&Answers:
arrayCollabName = Array("Name1","Name2",..., _
"Name N","Name n+1",...,_
...)

Underscore is the trick to seperate lines.