ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   How do I count the number of filtered rows (https://www.excelbanter.com/excel-worksheet-functions/124955-how-do-i-count-number-filtered-rows.html)

2D Rick

How do I count the number of filtered rows
 
I'm using XP SP2 and Microsoft Excel 11.0 8105 SP2.


After hours of searching and tweaking I give up.

=SUBTOTAL(3,B4:B5000)

The above works fine if placed in a cell but I can't get the same
results in VBA.

These don't work:

X = Application.WorksheetFunction.SUBTOTAL(3,B4:B5006)

X = SUBTOTAL(3,B4:B5006)

I want to use the row count to set the high limit of a FOR loop as the
filter changes the record count.

How do I count the number of filtered rows?????????

Thanks for any Help, Rick


Bob Phillips

How do I count the number of filtered rows
 
X = Application.SUBTOTAL(3,Range("B4:B5006"))


--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"2D Rick" wrote in message
oups.com...
I'm using XP SP2 and Microsoft Excel 11.0 8105 SP2.


After hours of searching and tweaking I give up.

=SUBTOTAL(3,B4:B5000)

The above works fine if placed in a cell but I can't get the same
results in VBA.

These don't work:

X = Application.WorksheetFunction.SUBTOTAL(3,B4:B5006)

X = SUBTOTAL(3,B4:B5006)

I want to use the row count to set the high limit of a FOR loop as the
filter changes the record count.

How do I count the number of filtered rows?????????

Thanks for any Help, Rick




2D Rick

How do I count the number of filtered rows
 
Thanks Bob, that did what I needed.

Rick


Bob Phillips wrote:
X = Application.SUBTOTAL(3,Range("B4:B5006"))


--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"2D Rick" wrote in message
oups.com...
I'm using XP SP2 and Microsoft Excel 11.0 8105 SP2.


After hours of searching and tweaking I give up.

=SUBTOTAL(3,B4:B5000)

The above works fine if placed in a cell but I can't get the same
results in VBA.

These don't work:

X = Application.WorksheetFunction.SUBTOTAL(3,B4:B5006)

X = SUBTOTAL(3,B4:B5006)

I want to use the row count to set the high limit of a FOR loop as the
filter changes the record count.

How do I count the number of filtered rows?????????

Thanks for any Help, Rick




All times are GMT +1. The time now is 07:00 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com