View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bill Manville Bill Manville is offline
external usenet poster
 
Posts: 473
Default How To: Get Last Cell

Kevin McCartney wrote:
I currently use Set rgeEnd = xlsheet.Cells.SpecialCells
(xlCellTypeLastCell) but for some reason the event
SheetSelectionChange triggers so how do I get the range of
the last cell (bottom right cell) in a sheet without using
the SpecialCells xlCellTypeLastCell.


Simpler would be to have your event handler ignore this case.
At the top of a normal module:

Public ItsMe As Boolean

In your code

ItsMe=True
Set rgeEnd = xlsheet.Cells.SpecialCells(xlCellTypeLastCell)
ItsMe=False

In your SheetSelectionChange

If ItsMe Then Exit Sub


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