Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
count count multiple rows | Excel Discussion (Misc queries) | |||
Count of Worksheet rows and recording this count | Excel Programming | |||
Count number of rows, where non relevant rows are hidden | Excel Discussion (Misc queries) | |||
Count rows and insert number to count them. | Excel Discussion (Misc queries) | |||
Why does rngDataSource.Rows.Count = 65536 when worksheet Rows=95? | Excel Discussion (Misc queries) |