Can't get the right count

TheJenson

New Member
Joined
Aug 12, 2011
Messages
30
I'm using a simple Do Loop to establish a count of excel entries for reDim'ing some dynamic arrays and for some reason which i have not yet been able to determine my counter counts one too many. Here is my code:

Code:
Do Until ActiveCell.Value = ""
    ActiveCell.Offset(1, 0).Range("A1").Select
    x = x + 1
Loop

When I reDim my arrays they still start correctly with the first array entry being array(0), but there is always one extra entry containing nothing because my counter is off. Any help would be much appreciated. Thanks!
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
ReDim your arrays 0 to x-1, or 1 to x
 
Upvote 0
You're welcome.

Explicitly declaring the lower bounds of arrays is a good habit to get into.
 
Upvote 0

Forum statistics

Threads
1,224,505
Messages
6,179,153
Members
452,891
Latest member
JUSTOUTOFMYREACH

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top