xlLastCell produces bizarre results

  • Thread starter Thread starter jon
  • Start date Start date
J

jon

I have a fairly simple Sheet with data down to E:85. When I calculate

NX = ActiveCell.SpecialCells(xlLastCell).row

the result is M:65536.

I've tried selecting and clearing all of the cells beyond the end of my real
data, but to no avail. I can share the offending Sheet with you
(individually) if you wish.

Any idea what is going on? I'm about to release an AddIn, and this problem
makes the AI blow up, which would be pretty embarrassing...

:)

Jon

jbondy at sover dot net
 
Jon,

By "selecting and clearing all of the cells beyond the end of my real data",
do you mean you used the Delete button or menu item Clear Contents? That
will not do the trick, you need to run menu item Delete, plus save the
workbook before the xlLastCell will actually return the end of your real
data.
Note: be sure to wipe out entire rows, not just the arera below the
populated columns!

HTH,
Nikos
 
Jon,

By "selecting and clearing all of the cells beyond the end of my real data",
do you mean you used the Delete button or menu item Clear Contents? That
will not do the trick, you need to run menu item Delete, plus save the
workbook before the xlLastCell will actually return the end of your real
data.
Note: be sure to wipe out entire rows, not just the arera below the
populated columns!

HTH,
Nikos
 

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