Over flow error

  • Thread starter Thread starter Ayo
  • Start date Start date
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?
 
Is rowCount defined as an integer? If so, what's the largest value
that variable could hold?

Hope this helps.

Pete
 
Add this line to the beginning of the macro

Dim rowcount as Long

Int can not hold 65536
 
Thanks Peter. I forgot to declear the variable, it should be long and not
integer.
 
You're welcome.

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

Pete
 
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
 

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

Similar Threads

To find row is empty or not 2
Code to delete rows giving mismatch error 8
macro filter 4
macro to filter 6
Run-time error '91' 4
Deleting rows - syntax wrong? 4
Is there a limit? 4
Type Mismatch Error 8

Back
Top