How do I count the number of filtered rows

2

2D Rick

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
 
B

Bob Phillips

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


--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)
 
2

2D Rick

Thanks Bob, that did what I needed.

Rick


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


--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top