Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 109
Default 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
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
Multiple criteria in autofilter BASFMark Excel Worksheet Functions 1 December 11th 08 06:38 PM
Autofilter - Supply Criteria JMay Excel Discussion (Misc queries) 2 January 2nd 07 01:29 PM
Improve autofilter combine conditionals with filter criteria dmcauli3 Excel Worksheet Functions 0 May 13th 05 01:27 PM
Displaying autofilter criteria [email protected] Excel Worksheet Functions 0 February 25th 05 09:41 PM
How can I detect an AutoFilter when the Criteria isnt Met Frederick Excel Programming 2 August 12th 03 02:43 PM


All times are GMT +1. The time now is 01:30 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"