Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Troy,
thanks, for your quick response. It works fine now ! "TroyW" wrote in message ... Fred, My first question is: What's wrong with the first section of code ? In the VBE Help, do a search on "declaring arrays". Select the "Declaring Arrays" item. In short, there are two types or arrays: 1) Static; 2) Dynamic. Redim can only be used with Dynamic arrays: Dim arrTest() But, you guessed, I get an error (nr. 9, out of range) on the "ReDim Preserve Arr(10, 1)" statement in the example code below. Can anyone tell me why this doesn't work ? In the VBE Help, do a search on "redim". The short answer is, if you use ReDim Preserve you can only redim the last dimension of a multidimensional array. For example: Dim arrTest(x,y,z) You can change z, but not x or y. Possible solution is to flip your array dimensions. Change Arr(x,y) to Arr(y,x). Troy |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
VBA syntax help: ReDim Preserve an array | Excel Discussion (Misc queries) | |||
Redim 2D Array Subscript Out Of Range Error | Excel Programming | |||
ReDim Problem | Excel Programming | |||
ReDim an Array | Excel Programming | |||
Redim MyArray | Excel Programming |