We help IT Professionals succeed at work.

Last Possible Cell in Excel

Triskelion
Triskelion asked
on
Is there an object or DEFINE or variable that represents the last possible cell in a spreadsheet?

We all know that in Excel 2000, the last cell is IV65536, however, that value (IMHO) should be registered as a constant with the Excel Framework.

I'm looking for something like
   xlLastRangeAddress or
   xlLastCellCoordinate or
   xlLastRow
   xlLastColumn

or even a value that would go in the SpecialCells function

ActiveSheet.Cells.SpecialCells( ...  ).Activate
Comment
Watch Question

Commented:
Hi... As I can remember, Excel cannot calculate the last cell correctly till you save and load your workbook.

Here in EE someone gave an advice: make a find from IV65535, looking for previous (xlPrevious) "*". If you do that by column, you'll find the last column used. If you do by row...etc.

Bye.

Author

Commented:
I guess what I'm asking is more of a version related question.  When the new version comes out or if you're working with an older version, how can you tell what the max number of cells will be?

Author

Commented:
...other than visibly scrolling or jumping to the bottom-right.

Commented:
One way I can think of would be a routine that trys the powers of 2 as row and column numbers. The limits are almost always a power  of two. Just keep increasing the row until you get an error (which you trap) then try rows in the same way.

Hope this helps.

Author

Commented:
Isn't there a hardcoded value that has this reference in it?

Author

Commented:
NO is also an answer.

Commented:
I gave you an answer other than NO though!

Author

Commented:
Yes, I understand.