rfletcher35
Active Member
- Joined
- Jul 20, 2011
- Messages
- 300
- Office Version
- 365
- Platform
- Windows
Hi,
I have tried to look to see if this has been solved but could not find so apologies if it is there.
This is the code I am using to filter on 2 criteria
However I am repeating myself several time as I have to do this a number of times in my workbook looking for relevant criteria, I have tried the following if this makes sense.
The above only works with again 2 criteria but I need to have several in there so I can condense my code.
Can anyone please help with this.
Many Thanks
Fletch
I have tried to look to see if this has been solved but could not find so apologies if it is there.
This is the code I am using to filter on 2 criteria
VBA Code:
'Filter for Diary / Calendar
ActiveSheet.Range("$A$1:$G$90").AutoFilter Field:=3, Criteria1:="*Diary*", Operator:=xlOr, Criteria2:="*Calendar*"
Range("A2").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
However I am repeating myself several time as I have to do this a number of times in my workbook looking for relevant criteria, I have tried the following if this makes sense.
VBA Code:
ActiveSheet.Range("$A$1:$G$10000").AutoFilter Field:=3, _
Criteria1:=Array("*Inbox*", "*Whitelist*", "*Diary*", "*Whitelist*", "*Inbox*"), _
Operator:=xlFilterValues
Can anyone please help with this.
Many Thanks
Fletch
Last edited by a moderator: