Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default count used rows

Hi all

How do I count the number of rows that hold some value in a worksheet? I
have tried several way but I always get also the empty rows in the count.

I just want the non-empty rows to be counted.

Something like

RowsCount = Worksheet(1).Rows.Count ?

thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 130
Default count used rows

On Oct 3, 12:07 pm, glenn wrote:
Hi all

How do I count the number of rows that hold some value in a worksheet? I
have tried several way but I always get also the empty rows in the count.

I just want the non-empty rows to be counted.

Something like

RowsCount = Worksheet(1).Rows.Count ?

thanks


At the end of each row, set one cell as =sum(A1:Z1)
Then set the next cell after it to =IF(AA1<"",1,0) - this will be
equal to one unless all values are ""
Then count the last column. I'm sure you can also do this in VBA as
well.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default count used rows

Sub test()

Count = 1
For RowCount = 1 To Rows.Count
If WorksheetFunction.Sum(Rows(RowCount)) 0 Then
Count = Count + 1
End If
Next RowCount


End Sub
"Andrew" wrote:

On Oct 3, 12:07 pm, glenn wrote:
Hi all

How do I count the number of rows that hold some value in a worksheet? I
have tried several way but I always get also the empty rows in the count.

I just want the non-empty rows to be counted.

Something like

RowsCount = Worksheet(1).Rows.Count ?

thanks


At the end of each row, set one cell as =sum(A1:Z1)
Then set the next cell after it to =IF(AA1<"",1,0) - this will be
equal to one unless all values are ""
Then count the last column. I'm sure you can also do this in VBA as
well.


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
count count multiple rows Lise Excel Discussion (Misc queries) 5 December 18th 08 04:41 AM
Count of Worksheet rows and recording this count mikerobe Excel Programming 2 March 21st 07 02:17 AM
Count number of rows, where non relevant rows are hidden Pieter Excel Discussion (Misc queries) 2 November 8th 06 12:24 PM
Count rows and insert number to count them. Mex Excel Discussion (Misc queries) 6 August 23rd 06 02:29 AM
Why does rngDataSource.Rows.Count = 65536 when worksheet Rows=95? [email protected] Excel Discussion (Misc queries) 12 July 22nd 05 12:50 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"