Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
DFS DFS is offline
external usenet poster
 
Posts: 5
Default Multiple or nested AdvancedFilters?

These successive VBA statements don't return "cumulative" results.

Range("G2:G2000").AdvancedFilter Action:=xlFilterInPlace,
CriteriaRange:=Range("G2499:G2510")

Range("K2:K2000").AdvancedFilter Action:=xlFilterInPlace,
CriteriaRange:=Range("K2499:K2510")

In other words, filter 2 doesn't apply to the results of filter 1.


So I tried to count how many rows are left after filter 1, and adjust the
range for filter 2

Range("G2:G2000").AdvancedFilter Action:=xlFilterInPlace,
CriteriaRange:=Range("G2499:G2510")

countFilteredRows = SUBTOTAL(3,A3:A2000)
Range("K2:K" & countFilteredRows).AdvancedFilter Action:=xlFilterInPlace,
CriteriaRange:=Range("K2499:K2510")


That doesn't work either.

Any ideas how I can make this work?


Thanks


  #2   Report Post  
Posted to microsoft.public.excel.programming
DFS DFS is offline
external usenet poster
 
Posts: 5
Default Multiple or nested AdvancedFilters? (RESOLVED)

SOLUTION:

Use Excel like you're supposed to:

1) build the data in the CriteriaRange correctly
2) apply one AdvancedFilter to the whole shebang

Voila!




DFS wrote:
These successive VBA statements don't return "cumulative" results.

Range("G2:G2000").AdvancedFilter Action:=xlFilterInPlace,
CriteriaRange:=Range("G2499:G2510")

Range("K2:K2000").AdvancedFilter Action:=xlFilterInPlace,
CriteriaRange:=Range("K2499:K2510")

In other words, filter 2 doesn't apply to the results of filter 1.


So I tried to count how many rows are left after filter 1, and adjust
the range for filter 2

Range("G2:G2000").AdvancedFilter Action:=xlFilterInPlace,
CriteriaRange:=Range("G2499:G2510")

countFilteredRows = SUBTOTAL(3,A3:A2000)
Range("K2:K" & countFilteredRows).AdvancedFilter
Action:=xlFilterInPlace, CriteriaRange:=Range("K2499:K2510")


That doesn't work either.

Any ideas how I can make this work?


Thanks



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
nested multiple if jenn Excel Worksheet Functions 11 November 25th 08 06:22 PM
Multiple nested If statements q3pd Excel Worksheet Functions 4 October 3rd 07 03:12 PM
Multiple (Nested) IF JaB Excel Discussion (Misc queries) 1 January 23rd 07 11:52 AM
Multiple Nested IFs, ORs, Ands Shelly Excel Worksheet Functions 5 January 9th 07 01:07 AM
how do I use multiple nested functions? TeeJay Excel Worksheet Functions 3 February 20th 05 05:09 PM


All times are GMT +1. The time now is 01:21 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"