Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 13th, 2011, 07:46 AM
Authorized User
 
Join Date: Aug 2011
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to count the number of rows of a filtered column!

Hi,

Here's my situation :

I've filtered my data using the 2nd column in excel(2003). I want to count the number of rows. It's 154 in total but after filtering it should reduce. But I'm not able to get the exact count. can anyone help me with this?

Thanks
Justin
 
Old September 13th, 2011, 08:44 AM
Authorized User
 
Join Date: Jan 2011
Posts: 86
Thanks: 1
Thanked 12 Times in 12 Posts
Default

Hi Justin,

using VBA or just when manually applying an autofilter?

When you've applied it manually it shoul be displayed in the statusbar how many records were affected..

When using VBA you could count the number of visible fields in the first column (minus 1 for the columnheader):
e.g. ActiveSheet.AutoFilter.Range.Columns(1).SpecialCel ls(xlCellTypeVisible).Count

Hope this helps
 
Old September 13th, 2011, 08:49 AM
Authorized User
 
Join Date: Aug 2011
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Disel,

Thanks for the reply. However, it throws me this error when I try to run it:

Run-time error '438':
Object doesn't support this property or method

Thanks
Justin
 
Old September 13th, 2011, 11:59 AM
JP JP is offline
Authorized User
 
Join Date: Apr 2008
Posts: 57
Thanks: 1
Thanked 3 Times in 3 Posts
Default

How about this?

http://www.contextures.com/xlautofilter03.html#Count
__________________
Regards,
JP
JP SoftTech
 
Old September 13th, 2011, 02:36 PM
Authorized User
 
Join Date: Aug 2011
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks JP... It really helps...





Similar Threads
Thread Thread Starter Forum Replies Last Post
Filtered Sharepoint list, not filtered in infopath wmrdude SharePoint Development 0 July 26th, 2006 05:09 AM
Display count of rows debjanib ASP.NET 1.0 and 1.1 Professional 7 May 5th, 2006 04:13 AM
count of rows ashokparchuri ADO.NET 3 April 19th, 2005 11:19 AM
count the number of rows in the table crmpicco Javascript How-To 4 February 2nd, 2005 12:58 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.