Solved

true row count of filtered range

Posted on 2014-04-05
5
339 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 47

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 47

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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
This article describes a serious pitfall that can happen when deleting shapes using VBA.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

752 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