I need to create an array with a variable as it size
For instance:
But this doesn't work, I get an error: "Constant expression required"![]()
Dim nSize as Integer nSize = 4 Dim nArray(nSize) as Integer
Is there anyway that I can do this?
I need to create an array with a variable as it size
For instance:
But this doesn't work, I get an error: "Constant expression required"![]()
Dim nSize as Integer nSize = 4 Dim nArray(nSize) as Integer
Is there anyway that I can do this?
Last edited by gtmeloney; 05-07-2009 at 02:44 PM.
See the ReDim statement. And you should always specify both upper and lower bounds of arrays as a matter of good practice.
Entia non sunt multiplicanda sine necessitate
Hi gtmelony,
The following works for me:
![]()
Dim nSize As Integer, nArray() nSize = 4 ReDim nArray(nSize)
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks