Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Finding row number at the bottom of a block of data

Hi - Essentially I need to find how many records in a worksheet.

I can do

Sub test1()
Sheets("Data").Select
Range("A1").Select
Selection.End(xlDown).Select
End Sub

Which taked me to the end of the block of data, but how do I:

a) Find the rownumber the curser stopped at?
b) put the cell address into a cell on a refernce sheet?

Any ideas?

Thanks

Andrew

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default Finding row number at the bottom of a block of data

To avoid stopping at a gap in the data it's usually better to start at the bottom....

dim r as range

set r=sheet1.cells(sheet1.rows.count,1).end(xlup)

then you can use

r.row
r.address



--
Tim Williams
Palo Alto, CA


"Andreww" wrote in message ps.com...
Hi - Essentially I need to find how many records in a worksheet.

I can do

Sub test1()
Sheets("Data").Select
Range("A1").Select
Selection.End(xlDown).Select
End Sub

Which taked me to the end of the block of data, but how do I:

a) Find the rownumber the curser stopped at?
b) put the cell address into a cell on a refernce sheet?

Any ideas?

Thanks

Andrew



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Finding row number at the bottom of a block of data

Splendid!

I'll try it in the morning.

Regards

Andrew

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
Finding Number Within Range Then Copying Data Below Number to Cells [email protected] Excel Programming 5 October 16th 06 06:32 PM
Finding the bottom non-blank cell in a range Fenneth Excel Discussion (Misc queries) 7 July 6th 06 06:05 PM
finding next empty row from bottom up!! matpj[_9_] Excel Programming 5 November 2nd 05 05:15 PM
finding next empty row from bottom up!! matpj[_5_] Excel Programming 0 November 2nd 05 04:11 PM
Finding Bottom of Sheet LizzyBorden1369 Excel Worksheet Functions 2 July 1st 05 08:37 PM


All times are GMT +1. The time now is 01:20 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"