Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Mex Mex is offline
external usenet poster
 
Posts: 19
Default Count rows and insert number to count them.

How do I get excel to automatically count the number of rows with data in
them and insert the row number in a colum. I don't want to count any blank
rows.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,124
Default Count rows and insert number to count them.

try

Sub countnonblanks()
lr = Cells(Rows.Count, "a").End(xlUp).Row
br = Range(Cells(1, 1), Cells(lr, 1)).SpecialCells(xlCellTypeBlanks).Count
MsgBox lr - br
End Sub

--
Don Guillett
SalesAid Software

"Mex" wrote in message
...
How do I get excel to automatically count the number of rows with data in
them and insert the row number in a colum. I don't want to count any blank
rows.



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 82
Default Count rows and insert number to count them.

The COUNT() function should do that, so if you want cell B1 to show a count
of the rows with data in column A use a formula like: =COUNT(A:A) in cell B1.

HTH,

TK

"Mex" wrote:

How do I get excel to automatically count the number of rows with data in
them and insert the row number in a colum. I don't want to count any blank
rows.

  #4   Report Post  
Posted to microsoft.public.excel.misc
Mex Mex is offline
external usenet poster
 
Posts: 19
Default Count rows and insert number to count them.

Sorry Don but I'm new at this. Do you mean that I need to type this all in as
one formula?
thx
"Don Guillett" wrote:

try

Sub countnonblanks()
lr = Cells(Rows.Count, "a").End(xlUp).Row
br = Range(Cells(1, 1), Cells(lr, 1)).SpecialCells(xlCellTypeBlanks).Count
MsgBox lr - br
End Sub

--
Don Guillett
SalesAid Software

"Mex" wrote in message
...
How do I get excel to automatically count the number of rows with data in
them and insert the row number in a colum. I don't want to count any blank
rows.




  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,124
Default Count rows and insert number to count them.

This is a macro. You would have to copy paste into a module and execute
using f8 or assign to a button. In your case it might be better to use the
formula suggested.

--
Don Guillett
SalesAid Software

"Mex" wrote in message
...
Sorry Don but I'm new at this. Do you mean that I need to type this all in
as
one formula?
thx
"Don Guillett" wrote:

try

Sub countnonblanks()
lr = Cells(Rows.Count, "a").End(xlUp).Row
br = Range(Cells(1, 1), Cells(lr,
1)).SpecialCells(xlCellTypeBlanks).Count
MsgBox lr - br
End Sub

--
Don Guillett
SalesAid Software

"Mex" wrote in message
...
How do I get excel to automatically count the number of rows with data
in
them and insert the row number in a colum. I don't want to count any
blank
rows.








  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,572
Default Count rows and insert number to count them.

It *should* be noted that the Count() function *only* counts numbers.

Since the OP only mentioned "data", it might be appropriate to cite that
fact, and to also suggest the CountA() function, which counts *all* types of
data ... literally counting *non-empty* cells.

=COUNTA(A:A)
--
Regards,

RD

---------------------------------------------------------------------------
Please keep all correspondence within the NewsGroup, so all may benefit !
---------------------------------------------------------------------------
"T Kirtley" wrote in message
...
The COUNT() function should do that, so if you want cell B1 to show a
count
of the rows with data in column A use a formula like: =COUNT(A:A) in cell
B1.

HTH,

TK

"Mex" wrote:

How do I get excel to automatically count the number of rows with data in
them and insert the row number in a colum. I don't want to count any
blank
rows.


  #7   Report Post  
Posted to microsoft.public.excel.misc
Mex Mex is offline
external usenet poster
 
Posts: 19
Default Count rows and insert number to count them.

Thanks for your help Don. n I was able to find an easier formula from an
earlier posting. Here is the link
http://www.j-walk.com/ss/excel/usertips/tip035.htm

"Don Guillett" wrote:

This is a macro. You would have to copy paste into a module and execute
using f8 or assign to a button. In your case it might be better to use the
formula suggested.

--
Don Guillett
SalesAid Software

"Mex" wrote in message
...
Sorry Don but I'm new at this. Do you mean that I need to type this all in
as
one formula?
thx
"Don Guillett" wrote:

try

Sub countnonblanks()
lr = Cells(Rows.Count, "a").End(xlUp).Row
br = Range(Cells(1, 1), Cells(lr,
1)).SpecialCells(xlCellTypeBlanks).Count
MsgBox lr - br
End Sub

--
Don Guillett
SalesAid Software

"Mex" wrote in message
...
How do I get excel to automatically count the number of rows with data
in
them and insert the row number in a colum. I don't want to count any
blank
rows.






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
Insert rows based on specific value bob Excel Worksheet Functions 6 February 29th 08 07:11 PM
Insert Next? Or insert a variable number of records...how? Tom MacKay Excel Discussion (Misc queries) 0 April 20th 06 10:44 PM
Insert a specified number of rows dynamically ttbbgg Excel Worksheet Functions 2 March 20th 06 08:27 PM
Insert a number of rows based on a value in a cell on active row iRocco Excel Discussion (Misc queries) 1 August 11th 05 06:18 AM
Insert a number of rows based on a value in a cell on active row iRocco Excel Worksheet Functions 0 August 10th 05 08:46 PM


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