Auto Filter Macro

BenLightfoot

New Member
Joined
Mar 25, 2011
Messages
2
Hi, I am having a little issue with an autofilter Macro I have set up.. I'm sure this is quite simple so if any one can help it would be much appreciated.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
<o:p></o:p>
I have a Macro that filters various sheets on a name that a person selects on a control sheet. The Macro looks at that name then simply filters the sheets.. Now what If I don't want a filter to apply? What would the Macro lookup, you have to select something from the drop down box before continuing, I have tried putting in (Select All) as an option but the filter returns nothing. Below is the Macro.. And it is the "SectorFilter" range that has the persons name in.<o:p></o:p>
<o:p></o:p>

Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:=Range("SectorFilter"), Operator:=xlAnd<o:p></o:p>

<o:p></o:p>
Many thanks<o:p></o:p>
<o:p></o:p>
Ben<o:p></o:p>
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
maybe something like

Code:
Selection.AutoFilter
if range("sectorfilter")<>"Select all" then
Selection.AutoFilter Field:=1, Criteria1:=Range("SectorFilter"), Operator:=xlAnd
end if
 
Upvote 0
Thanks Guys! I have sorted it now.. I have just put a conditional IF in based on the filter..

I'm new to Macros so thank you for the advice.

Cheers

Ben
 
Upvote 0

Forum statistics

Threads
1,224,552
Messages
6,179,486
Members
452,917
Latest member
MrsMSalt

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top