• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 346
  • Last Modified:

true row count of filtered range

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
discogs
Asked:
discogs
  • 2
  • 2
1 Solution
 
helpfinderIT ConsultantCommented:
use SUBTOTAL formula
like =SUBTOTAL(2,your_range)
0
 
discogsAuthor Commented:
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
 
Martin LissOlder than dirtCommented:
Try

MsgBox Cells(1).CurrentRegion.Columns(1).SpecialCells(xlCellTypeVisible).Count - 1
0
 
discogsAuthor Commented:
Perfect! That's exactly what I was looking for..
0
 
Martin LissOlder than dirtCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now