Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Redim MyArray
Hi,
I don't understand why Redim doesn't work. I get a message that "Het aantal dimensies al is bepaald" Can someone help me please Dim MyArray(4, 10) x = 1 With rs .MoveFirst Do Until .EOF MyArray(0, x) = .Fields("Lozingsnummer").Value MyArray(1, x) = .Fields("RedenLozing").Value x = x + 1 ReDim Preserve MyArray(5, x) .MoveNext Loop End With |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Redim MyArray
You have two problems.
First, to use ReDim you must declare the array without dimensions. Dim MyArray() Second, when using Preserve you can only redimension the final index. so if you have Dim MyArray() Redim Myarray(3,6) then you can do: Redim Preserve MyArray(3,8) but NOT Redim Preserve MyArray(4,6) You'll have to turn your dimensions round or find another way. Regardsd Peter Russell Peter Pantus previously wrote: Hi, I don't understand why Redim doesn't work. I get a message that "Het aantal dimensies al is bepaald" Can someone help me please Dim MyArray(4, 10) x = 1 With rs .MoveFirst Do Until .EOF MyArray(0, x) = .Fields("Lozingsnummer").Value MyArray(1, x) = .Fields("RedenLozing").Value x = x + 1 ReDim Preserve MyArray(5, x) .MoveNext Loop End With |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Redim MyArray
Peter,
Thanks a lot. It works perfect "Peter Russell" schreef in bericht net.com... You have two problems. First, to use ReDim you must declare the array without dimensions. Dim MyArray() Second, when using Preserve you can only redimension the final index. so if you have Dim MyArray() Redim Myarray(3,6) then you can do: Redim Preserve MyArray(3,8) but NOT Redim Preserve MyArray(4,6) You'll have to turn your dimensions round or find another way. Regardsd Peter Russell Peter Pantus previously wrote: Hi, I don't understand why Redim doesn't work. I get a message that "Het aantal dimensies al is bepaald" Can someone help me please Dim MyArray(4, 10) x = 1 With rs .MoveFirst Do Until .EOF MyArray(0, x) = .Fields("Lozingsnummer").Value MyArray(1, x) = .Fields("RedenLozing").Value x = x + 1 ReDim Preserve MyArray(5, x) .MoveNext Loop End With |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
VBA syntax help: ReDim Preserve an array | Excel Discussion (Misc queries) |