Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default How do I set up a counter cell?

I need to set up a cell that counts the number of rows I am using, and sets
that number in a cell. Is there a way to make sure to check to see if the row
has a value in the first cell. I know i need to set up some type of if
statement for this, but I'm not sure how to go about it. Can anyone help me?
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default How do I set up a counter cell?

Hi,

Right click the sheet tab, view code and paste this in. Change the cell
address to whatever you want:-

Private Sub Worksheet_Change(ByVal Target As Range)
Range("A1").Value = ActiveSheet.UsedRange.Rows.Count
End Sub

Mike

"Valpocandi" wrote:

I need to set up a cell that counts the number of rows I am using, and sets
that number in a cell. Is there a way to make sure to check to see if the row
has a value in the first cell. I know i need to set up some type of if
statement for this, but I'm not sure how to go about it. Can anyone help me?

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,311
Default How do I set up a counter cell?

What should be included in your row count? If the first row contains no
data, should that row be counted?
Assuming that you want to omit the first row in your count only if it
contains no data, then maybe something like this:

=IF(COUNTA(1:1)=0,COUNTA(A:A)-1,COUNTA(A:A))

Keep in mind that this will count rows if column A of the row contains data.
If column A contains no data, then it is assumed that the row is empty.

HTH,
Paul


--

"Valpocandi" wrote in message
...
I need to set up a cell that counts the number of rows I am using, and sets
that number in a cell. Is there a way to make sure to check to see if the
row
has a value in the first cell. I know i need to set up some type of if
statement for this, but I'm not sure how to go about it. Can anyone help
me?



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
dynamic character counter for merged cell text field JASelep Excel Worksheet Functions 1 August 29th 07 07:24 PM
1+2+3+4+........... Counter 23Hitamn Excel Discussion (Misc queries) 3 August 28th 07 10:17 AM
using a cell value to control a counter inside a macro and displaying macro value ocset Excel Worksheet Functions 1 September 10th 06 05:32 AM
Cell counter Haza Excel Discussion (Misc queries) 2 January 20th 06 02:18 PM
Counter Sdbenn90 Excel Discussion (Misc queries) 4 January 9th 06 11:43 AM


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