View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bill Manville Bill Manville is offline
external usenet poster
 
Posts: 473
Default xlLastCell question

Rich wrote:
I tried this command in a macro.

ActiveCell.SpecialCells(xlLastCell).Select

I thought that the above command will return the last cell that
contains data. When I issued this command, it returned a cell that was
blank.


Try
ActiveSheet.UsedRange.SpecialCells(xlLastCell).Sel ect

LastCell gives the cell in the last Row that has been used and the last
Column that has been used since the worksheet was created - or since the
UsedRange method was used on the sheet.


Bill Manville
MVP - Microsoft Excel, Oxford, England
No email replies please - reply in newsgroup