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

Using those special cells is a bit like using the F5
(GoTo) key, and thus fires the selection change event.

If you want the last cell in a column
Set rgeEnd = Range("A1").End(xlDown)
OR
Set rgeEnd = Range("A65000").End(xlUp)
which I prefer as it means we don't worry about gaps in
the column.

If you must use the special cells then try this

Application.EnableEvents = False

Set rgeEnd = Cells.SpecialCells(xlCellTypeLastCell)

Application.EnableEvents = True

Patrick Molloy
Microsoft Excel MVP

-----Original Message-----
Hi,
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.

regards
KM
.