Filter with more than one criteria.. Begins With and equals too

ronanbaker1

Board Regular
Joined
Nov 15, 2012
Messages
76
Hi,

I need a macro that will filter all properties starting with SA.
I also need to someway link in specific properties to the filter. Ie BTA, DSA, etc there are many....

Thanks

Ronan
 
Hi Peter,

Although I thought it would be the same if I changed some data it it not. Sorry to be bothering you about this but could you make this work?
Dim aVals
Const sVals As String = "=SA*,=PRIAC*,=BAT,=COMFUT,=DCP,=GICFUND,=GISACOMM," _
& "=GPSA, =GMSA, =GRPAN, =HICKORY, =IADEF, =IAPAY," _
& "=PARCC, =PARCCORP, =PARTCORP, =PARTCUST, =PARU, =PARUNJTR1, =PLAZTR1, =PLAZTR2, =PLNJMM, =PLNJTR1, =PLNJTR2, =PLUSUSD, =PPBO, =PRIVEST, =PRIVESTPLUS, =SEA, =SEASIADCP2, =UPARCC," _
& "=UPLAZTR1, =UPLAZTR2"


aVals = Split(sVals, ",")
Columns("R").Insert
Range("R1").Value = Range("A1").Value
With Range("R2").Resize(UBound(aVals) + 1)
.NumberFormat = "@"
.Value = WorksheetFunction.Transpose(aVals)
End With
Range("A1:Q5000").AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:= _
Range("R1").Resize(UBound(aVals) + 2), Unique:=False
Columns("R").Delete



What is happening is that it is filtering some values but not all of them? And my spelling is correct.
When posting code, please use Code tags - see my signature block for how to do it. Reading/debugging unindented code is much harder.

It looks to me that in the red part you've started inserting spaces after the commas.
 
Upvote 0

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.

Forum statistics

Threads
1,215,790
Messages
6,126,923
Members
449,348
Latest member
Rdeane

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