Solved

true row count of filtered range

Posted on 2014-04-05
5
338 Views
Last Modified: 2014-04-05
Hi there,

In excel 2010 I have a filtered range called data. When I filter it using criteria,  I want to return the true row count of only the visible cells or filtered results.

Does  anyone have any idea on how  I can do this with vba?

TA
0
Comment
Question by:discogs
  • 2
  • 2
5 Comments
 
LVL 19

Expert Comment

by:helpfinder
ID: 39980483
use SUBTOTAL formula
like =SUBTOTAL(2,your_range)
0
 

Author Comment

by:discogs
ID: 39980509
Hi thanks for your answer.

I am trying to integrate this into a vba function that does other thing.

That said, I was more looking for something like:

MyTrue Count = Intersect(.SpecialCells(xlCellTypeVisible), .Range(.Rows(2), .Rows(.Rows.Count)))

Open in new window


TA
0
 
LVL 46

Accepted Solution

by:
Martin Liss earned 500 total points
ID: 39980602
Try

MsgBox Cells(1).CurrentRegion.Columns(1).SpecialCells(xlCellTypeVisible).Count - 1
0
 

Author Closing Comment

by:discogs
ID: 39980616
Perfect! That's exactly what I was looking for..
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 39980623
You're welcome and I'm glad I was able to help.

In my profile you'll find links to some articles I've written that may interest you.
Marty - MVP 2009 to 2014
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question