Maximum Range size?

A

andycharger

I have a spreadsheet with 27,000+ rows on it.
I am using a macro to colour code the rows depending on criteria.

However, I notice when I set my range it is only going up to 7589!

Is there a maximum number of rows in a range and can yo tell me what m
problem might be from my code below. Perhaps im not setting the rang
correctly?

[vb]
Dim RowInx As Long
For RowInx = Range("A1").End(xlDown).Row To 2 Step -1
Dim sreNum As Integer
sreNum = Month(Cells(RowInx, "O").Value)

'do some stuff that you dont need to see!

Next
[/vb]

Like I said there are over 27,000 rows on the sheet but the range i
only seeing 7589!

Help
 
N

Norman Jones

Hi Andy,

Try: For Cells(Rows.Count,"A").End(xlUp).Row

Using your End(xlDown) method will fail to select the last row if there are
any intervening blank cells - check cell A7589 and it will probably prove to
be blank.
 
Top