Nightmare with Arrays
Perfect
Thanks Sam
"Sam Wilson" wrote:
Hi Steve - it's easy once you know how.
sub ArrayDemo()
dim A as string() 'or whatever datatype you want
dim i as integer
for i = 0 to 10
redim preserve A(i)
A(i) = Range("a1").offset(i,0).value
next i
end sub
Redim is the command to change the dimension of the array, preserve means to
keep all the data in there.
Sam
"Steve" wrote:
Hi
I did write yesterday but with no real success.
I am trying to put a number of values in an array by looping through some
cells.
I'm having difficulty as I don't know how long the array will be nor can I
sem to add to it.
I have tried the following so far.
A=array() - create an empty array
A(0) = cells(count,1).value
A(1) = cells(count,2).value
etc etc
I have looked at similar code that puts cell information into an array and I
think it's the creation of a blank array that is the problem.
The trouble is that I do not know how big the array is going to be.
Any guidance would be appreciated.
Thanks
Steve
|