Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Judy Ward
 
Posts: n/a
Default Display count of rows

I have been asked to display a count of the rows in each sheet of an Excel
file at the top of each sheet (so that the user does not have to scroll down
to see how many rows of data there are). I want to do this through code.

Is this the best way to get a count of the rows:
ActiveSheet.UsedRange.Rows.Count
And I probably need to subtract 1 for the row with headings.

I also need to know--is there a way to display the count of rows above row 1
(where the column headings are)? Is there a row zero?

Thank you for any help you can give me,
Judy
  #2   Report Post  
JE McGimpsey
 
Posts: n/a
Default

One way:

=COUNTA(A:A)-1

There is no row zero. You could insert a row above the headings (which
would then be in Row 2) and use

=COUNTA(A:A)-2

In article ,
Judy Ward wrote:

I have been asked to display a count of the rows in each sheet of an Excel
file at the top of each sheet (so that the user does not have to scroll down
to see how many rows of data there are). I want to do this through code.

Is this the best way to get a count of the rows:
ActiveSheet.UsedRange.Rows.Count
And I probably need to subtract 1 for the row with headings.

I also need to know--is there a way to display the count of rows above row 1
(where the column headings are)? Is there a row zero?

Thank you for any help you can give me,
Judy

  #3   Report Post  
Biff
 
Posts: n/a
Default

Hi!

Another way that accounts for empty rows within the range. Returns the row
number of the last cell in column A that contains data.

Entered as an array using the key combo of CTRL,SHIFT,ENTER:

=MAX(IF(A2:A65536<"",ROW(2:65536)))

Assumes row 1 (A1) is a header.

Note also, will not "count" cells that contain formula blanks. Suppose that
cell A100 has a formula returned value of "X" and there are formula blanks
from A101 to A200. The above formula will return 100 as the last row in
column A that contains data.

Biff

"Judy Ward" wrote in message
...
I have been asked to display a count of the rows in each sheet of an Excel
file at the top of each sheet (so that the user does not have to scroll
down
to see how many rows of data there are). I want to do this through code.

Is this the best way to get a count of the rows:
ActiveSheet.UsedRange.Rows.Count
And I probably need to subtract 1 for the row with headings.

I also need to know--is there a way to display the count of rows above row
1
(where the column headings are)? Is there a row zero?

Thank you for any help you can give me,
Judy



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
Getting Count field to recognise rows with negative values in Exc. hamish Excel Worksheet Functions 2 June 20th 05 05:06 AM
Count Rows with Conditional Format? Ken Excel Discussion (Misc queries) 3 March 24th 05 02:27 PM
Display No. of Rows in Status Bar Marty Excel Discussion (Misc queries) 2 January 24th 05 10:29 PM
Data Filter - Not all rows in spreadsheet will display in Autofilt Excel Help Excel Worksheet Functions 1 November 17th 04 05:40 PM
Count rows based on multiple criteria Murph Excel Worksheet Functions 1 October 28th 04 07:13 AM


All times are GMT +1. The time now is 04:23 AM.

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

About Us

"It's about Microsoft Excel"