Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Quick question - is there an easy way to find which row is the last with data?

I've got a spreadsheet that's set up with (for example) 1000 rows (with
properties set for those 1000 rows). But likely only a few hundred of those
will actually contain data (the rest will be blank).

Is there an easy way (in VBA) to find which row has the last non-blank data?

At first I thought I'd use:

ActiveSheet.UsedRange.Rows.Count


Unfortunately, that seems to be returning my 1000 rows every time (even if
the "real" data is only up to row 200).

I'd rather not build a for...next loop to find it, as that'd be horrifically
slow.

Any ideas?


Thanks!
-Scott


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 130
Default Quick question - is there an easy way to find which row is thelast with data?

Go to

http://groups.google.com/advanced_group_search

and search for

Last cell in range

Alan Beban


Scott Lyon wrote:
I've got a spreadsheet that's set up with (for example) 1000 rows (with
properties set for those 1000 rows). But likely only a few hundred of those
will actually contain data (the rest will be blank).

Is there an easy way (in VBA) to find which row has the last non-blank data?

At first I thought I'd use:

ActiveSheet.UsedRange.Rows.Count


Unfortunately, that seems to be returning my 1000 rows every time (even if
the "real" data is only up to row 200).

I'd rather not build a for...next loop to find it, as that'd be horrifically
slow.

Any ideas?


Thanks!
-Scott



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Quick question - is there an easy way to find which row is the last with data?

That worked nicely! And quick too!

Thanks, Chip!

-Scott

"Chip Pearson" wrote in message
...
Scott,

Try something like

Dim LastRow As Long
LastRow = Cells(Rows.Count, "A").End(xlUp).Row
MsgBox "Last Row Is " & LastRow

Change the "A" to the appropriate column.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Scott Lyon" <scott.lyonNOSPAM_at__NOSPAMrapistan.comNOSPAM wrote
in message ...
I've got a spreadsheet that's set up with (for example) 1000

rows (with
properties set for those 1000 rows). But likely only a few

hundred of those
will actually contain data (the rest will be blank).

Is there an easy way (in VBA) to find which row has the last

non-blank data?

At first I thought I'd use:

ActiveSheet.UsedRange.Rows.Count


Unfortunately, that seems to be returning my 1000 rows every

time (even if
the "real" data is only up to row 200).

I'd rather not build a for...next loop to find it, as that'd be

horrifically
slow.

Any ideas?


Thanks!
-Scott






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
Looking for a easy and quick way to share a workbook only with mys OldRetiredGuy Excel Discussion (Misc queries) 1 November 24th 09 05:09 AM
Quick/Easy Question? Dave Excel Discussion (Misc queries) 2 February 24th 09 06:44 PM
data validation quick find Richard Excel Discussion (Misc queries) 9 September 22nd 07 01:44 AM
Quick and easy labeling mmednick Excel Discussion (Misc queries) 4 December 7th 05 01:12 AM
Quick and easy chisigs2 Excel Worksheet Functions 2 August 24th 05 08:36 PM


All times are GMT +1. The time now is 11:57 AM.

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"