View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Patrick Molloy[_4_] Patrick Molloy[_4_] is offline
external usenet poster
 
Posts: 103
Default How to find first and last cell in a Sheet with an entry

dim lastcell as range
set lastcell = Range("A65536").end(xlup)

msgbox "Last row is " & lastcell.row
msgbox "Last column is " & lastcell.column

also a worksheet's UsedRange returns the area 'used' (!)
BUT you alos need to get the Ysed range's position.
So a ysedrange begins in row UsedRange.Row and fills UsedRange.Rows.Count
so adding these together gives the last row use din a sheet...

With ActiveSheet
lastrow = .UsedRange.Row + .UsedRange.Rows.Count - 1
End With


Patrick Molloy
Microsoft Excel MVP
----------------------------------
"Hölzl Otto" wrote in message
...
Hallo, friends!
Is there a short way to find the first (last) row(column) that contains an
entry?
Please give me a hint!
Thanks
Otto