Over flow error

A

Ayo

rowCount = Worksheets("Commits").Range("D65536").End(xlUp).Row

The above line of code is giving me an oveflow error. I have used something
exactly like it many times before and it woked, but this time with this line
I get the error message.

Any ideas?
 
P

Pete_UK

Is rowCount defined as an integer? If so, what's the largest value
that variable could hold?

Hope this helps.

Pete
 
S

Sheeloo

Add this line to the beginning of the macro

Dim rowcount as Long

Int can not hold 65536
 
P

Pete_UK

You're welcome.

This point is even more important if your macros might be used with
XL2007 in the future.

Pete
 
H

Harald Staff

True. And also that 65536 may not be below last row:

Worksheets("Commits").Cells(Worksheets("Commits").Rows.Count,
4).End(xlUp).Row

Best wishes Harald

You're welcome.

This point is even more important if your macros might be used with
XL2007 in the future.

Pete
 
Top