If I have a variable called myarray, I usually declare it as follows:
Assuming I have some data starting in cell (A1), to assign data to the variable I write:
However, I have noticed if there is only one value, ie only cell A1 is populated, all other cells around it are not, then declaring myarray() would fail.
Instead, simply declaring myarray (without the ()) works.
So my question is, is this
preferable to
I thought adding the brackets would help identify that myarray is an array variable but it seems it has its limitations.
Thanks
Code:
Dim myarray() As ' whatever you want but usually I choose Variant
Assuming I have some data starting in cell (A1), to assign data to the variable I write:
Code:
myarray=Cells(1,1).CurrentRegion.Value
However, I have noticed if there is only one value, ie only cell A1 is populated, all other cells around it are not, then declaring myarray() would fail.
Instead, simply declaring myarray (without the ()) works.
So my question is, is this
Code:
Dim myarray As
preferable to
Code:
Dim myarray() As
I thought adding the brackets would help identify that myarray is an array variable but it seems it has its limitations.
Thanks