Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default How to find first and last cell in a Sheet with an entry

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default How to find first and last cell in a Sheet with an entry

Otto,

Last row

Range("A1").End(xlDown).Row

If there might be empty cells in that range, then use

Cells(Rows.Count,"A").End(xlUp).Row

Similarly for columns

Range("A1").End(xlToRight).Column

or

Cells(1,Columns.Count).End(xlToLeft).Column

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"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




  #3   Report Post  
Posted to microsoft.public.excel.programming
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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to find duplicate entry in one sheet and in workbook sanjay Excel Discussion (Misc queries) 1 May 30th 10 03:43 PM
find the cell reference for the next occurrance of entry in array Tepax Excel Worksheet Functions 2 August 24th 09 10:01 PM
Find cell entry contained anywhere within a text string VickiMc Excel Worksheet Functions 2 February 12th 09 03:07 AM
in one sheet add one word after every entry in every cell. how? Sandy Excel Worksheet Functions 3 December 20th 06 07:04 PM
FIND THE LAST CELL ENTRY IN A ROW Carolyn Bennett Excel Worksheet Functions 7 January 18th 06 05:51 AM


All times are GMT +1. The time now is 12:44 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"