Filling an array with a Loop

  • Thread starter Thread starter Kevin O'Neill
  • Start date Start date
K

Kevin O'Neill

Dim d as String
For d = 0 to 6
ends(d) = Range("A50000").End(xlUp).Row
Next d

I want to populate the array with the end row of each of my loops, and
then pass that array to another sub for use.

Suggestions?
 
Dim ends(5) As Integer
For d = 5 to 0 step -1
ends(d) = Range("A50000").End(xlUp).Row
Next d

Better. It works, but, my array size will not always be 5 (6 including
0). It must be constant? My loop steps backwards, and fills my array
backwards. How can I reverse it?
 
kevin -

i find this a little puzzling.

is ends(5) supposed to be the same number as ends(0)? in this example you
always start with the same cell (A50000) and go up - with nothing else in
the loop all ends(x) will be the same

have you tried offset? like:

ends = range("a100").offset(5,0)

ends then becomes an array of values

- voodooJoe
 
Joe, there is actually alot of other code inside the loop I cut out, I
just didn't show it. I managed to figure it out. Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top