VBA CODE FOR Filtering

excelindianfanclub

Board Regular
Joined
Oct 20, 2012
Messages
64
S.No</SPAN>Job type</SPAN>Problem</SPAN>
BD</SPAN>
B.D</SPAN>
B/D</SPAN>
B_D</SPAN>
B D</SPAN>
PJ</SPAN>
P.J</SPAN>
P/J</SPAN>
P_J</SPAN>
P J</SPAN>
PM</SPAN>
P.M</SPAN>
P/M</SPAN>
P_M</SPAN>
BDS
BD/S
BD.S






</SPAN>

<TBODY>
</TBODY><COLGROUP><COL span=3></COLGROUP>


in Job Type Column,the Job type is mentioned in different text for example BD is mentioned as BD,B.D,B/D,B_D,B<space>D.. so i need the macro button to filter all of them in one click.This applicable for muliselecion filtering also.when i click the macro button,it should filter all the Text contains BD,PJ,PM & BDS.
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Dear Arctic,
thanks for reply
i modified the code to

AutoFilter Field:=1, Criteria1:="=*B*D", Operator:=xlFilterValues.

it works.
but i need a macro code to all the different Job types which are in various Text representation, to get filtered by single click.there are 15 job types
in those,i need to filter this BD,PJ,PM,BDS
 
Upvote 0
Selection.AutoFilter Field:=1, Criteria1:="=B*", Operator:=xlAnd, _
Criteria2:="=*D"

ETC


I modified the code for two criteria

Selection.AutoFilter Field:=2, Criteria1:="=A*D*R", _
Operator:=xlOr, Criteria2:="=B*D*S"

this works.but more than 2 criteria,this code format cannot be used.Please give me an idea
 
Upvote 0

Forum statistics

Threads
1,216,105
Messages
6,128,859
Members
449,472
Latest member
ebc9

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