pedie
Well-known Member
- Joined
- Apr 28, 2010
- Messages
- 3,875
Hi, I need help with Vba to filter by data depending on my critiria...
my critiria can change and are from A1:A to lastrow...
So is it possible to loop through & store my critia in array and then apply filter with it?
my critiria can change and are from A1:A to lastrow...
So is it possible to loop through & store my critia in array and then apply filter with it?
Code:
[/FONT]
[FONT=Courier New]Option Explicit
Sub test()
Range("A7").Select
Selection.CurrentRegion.Select
Selection.AutoFilter
ActiveSheet.Range("$A$6:$D$11").AutoFilter Field:=3, Criteria1:=Array( _
[B][COLOR=blue]"DEPT1", "DEPT2", "DEPT3", "DEPT4"),[/COLOR][/B] Operator:=xlFilterValues
End Sub