Overflow problem

  • Thread starter Thread starter Lionel Fridjhon
  • Start date Start date
L

Lionel Fridjhon

I am looping to add data to the last row of a large
spreadsheet.
I am using the statement "Range("B1").End(xlDown).Select"
to get the last row. The next statement is "variable
=selection.row + 1"

When I get to selection.Row = 32767 and try to add 1 to
the row number, I get an overflow message.
There are 63,535 rows in the spreadsheet, and 32767 is
almost half of that number.

Any clues as to what is happening?

Lionel
 
If you have dimensioned variable as an integer, you've found you
problem.

Change to Dim Variable as Long
 
Hi Lionel

"variable" is declared Integer ? Never use Integer.

HTH. Best wishes Harald
 
Variable is declared as Integer or at least is an integer which can only
store the number you cite - then it overflows. Dim variable as Long
 

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