Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Go to the Last Row for Counting Purposes


How do you go to the last row that contains data in a spreadsheet if
there are numerous rows that do not contain any data?

What I really want to do is to be able to determine the number of
"blocks" of data that I have. The "blocks" are separated by empty
rows. The problem is that the number of "blocks" will increase over
time as more data is added. I'm thinking that once I determine the
last row number of the last block, I could use that as a counter (and
divide by 14 since the spacing between blocks is 14)

Here is an example of the data that I'm working with:


xxxxxxxxxx
yyyyyyyyyy "block 1"
zzzzzzzzzz

14 rows

aaaaaaaaa
bbbbbbbbb "block 2"
cccccccccccc

14 rows

mmmmmmm
nnnnnnnnnn "block 3"
oooooooooo

14 rows

more data to be added in the future

Can you help? Thanks.


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Go to the Last Row for Counting Purposes

Assuming column A can be used to make the determination:

Set rng = Columns(1).specialCells(xlConstants)
set lastBlock= rng.Areas(rng.Areas.count)
lastrow = LastBlock.Rows(LastBlock.rows.count).Row
msgbox rng.Areas.count & "Blocks, last row: " & LastRow

or

LastRow = cells(rows.Count,"A").End(xlup).Row
msgBox "Last Row is " & LastRow

--
Regards,
Tom Ogilvy


Novice wrote in message
...

How do you go to the last row that contains data in a spreadsheet if
there are numerous rows that do not contain any data?

What I really want to do is to be able to determine the number of
"blocks" of data that I have. The "blocks" are separated by empty
rows. The problem is that the number of "blocks" will increase over
time as more data is added. I'm thinking that once I determine the
last row number of the last block, I could use that as a counter (and
divide by 14 since the spacing between blocks is 14)

Here is an example of the data that I'm working with:


xxxxxxxxxx
yyyyyyyyyy "block 1"
zzzzzzzzzz

14 rows

aaaaaaaaa
bbbbbbbbb "block 2"
cccccccccccc

14 rows

mmmmmmm
nnnnnnnnnn "block 3"
oooooooooo

14 rows

more data to be added in the future

Can you help? Thanks.


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/



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
Names of ratios and their purposes Dhammika Excel Discussion (Misc queries) 2 January 13th 09 12:18 PM
Splitting hours for payroll purposes Neil Gerace Excel Discussion (Misc queries) 4 February 29th 08 05:08 AM
Need list of Formulas and their Purposes Sage Excel Discussion (Misc queries) 2 September 18th 07 06:54 PM
Is there a way for excel to recognise that €0.00 = 0 for the purposes IF function ? CmTaz Excel Discussion (Misc queries) 4 March 6th 06 03:45 AM
create macro for learning purposes jzzman Excel Worksheet Functions 1 July 1st 05 03:34 PM


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