Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dreaded MultiDimensional Array 1

Status
Not open for further replies.

sn0rg

IS-IT--Management
Joined
Aug 5, 2005
Messages
95
Location
GB
Having real problems creating and populating one.

I want to read in the content of a spreadsheet into an array. I count each row incrementing a variable (intRow) until I reach the end of the sheet. I know there will be 4 columns.

Problem is, that I cannot then use the intRow variable to declare the array (ie Dim MyArray(intRow,3). I get a Expected Literal Constant error.

How can I use intRow (or some derivative of it) to declare the array?
 
If the variable dimension is not the last, you can do it once and once only.
[tt]
dim a 'or dim a(), both the same
n=10
redim a(n,3)
wscript.echo ubound(a,1)
[/tt]
If you want to change more times, you need to make it to the last index.
 
Thanks Tsuji, works a treat.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top