Solved

true row count of filtered range

Posted on 2014-04-05
5
334 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 45

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 45

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction This Article is a follow-up to my Mappit! Addin Article (http://www.experts-exchange.com/A_2613.html), it was inspired by an email posting I made to EUSPRIG (http://www.eusprig.org/index.htm), I will briefly cover: 1) An overvie…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

743 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now