Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA Autofilter Criteria
Is it possible to create a macro that will:
1) Activate the Autofilter 2) Prompt the user for autofilter criteria by selecting from a list of unique records in column A (only criteria1 is needed) 3) Engage the Autofilter and show the results based on this selection I recorded turning the Autofilter on and selecting an example of the criteria; but I'm not sure how to create the prompt. Sub FILTERBYA() ' ' FILTERBYA Macro ' Macro recorded 11/06/2003 by Brandon ' ' Columns("A:G").Select Selection.AutoFilter Selection.AutoFilter Field:=1, Criteria1:="Boats" Range("A5").Select End Sub _________________________________________ Thank you for your time, Brandon |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA Autofilter Criteria
How about this for a scenario.
1. Sort your data (eg.using Column B) 2. Make an extra column in your list (here used A to check B) with the formula =IF(AND(B2<B1,B2<B3),"Unique","") 3. Start the autofilter 4. Filter on 'Unique'. You can then select individual unique records to view. Regards BrianB =========================================== "Brandon" wrote in message ... Is it possible to create a macro that will: 1) Activate the Autofilter 2) Prompt the user for autofilter criteria by selecting from a list of unique records in column A (only criteria1 is needed) 3) Engage the Autofilter and show the results based on this selection I recorded turning the Autofilter on and selecting an example of the criteria; but I'm not sure how to create the prompt. Sub FILTERBYA() ' ' FILTERBYA Macro ' Macro recorded 11/06/2003 by Brandon ' ' Columns("A:G").Select Selection.AutoFilter Selection.AutoFilter Field:=1, Criteria1:="Boats" Range("A5").Select End Sub _________________________________________ Thank you for your time, Brandon |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Multiple criteria in autofilter | Excel Worksheet Functions | |||
Autofilter - Supply Criteria | Excel Discussion (Misc queries) | |||
Improve autofilter combine conditionals with filter criteria | Excel Worksheet Functions | |||
Displaying autofilter criteria | Excel Worksheet Functions | |||
How can I detect an AutoFilter when the Criteria isnt Met | Excel Programming |