bentez2003
New Member
- Joined
- Feb 26, 2013
- Messages
- 43
Hi,
I have a list of countries in cells a2:a12 on sheet1 (some are duplicates) that i would like to use as my search criteria.
I have a range of data on sheet2 b2:g200, column B contains available countries.
How can i filter B by my multiple criteria cells?
the below is what i started working with but i can't get my different criteria to group together when filtered. the below leaves me with an empty filter.
Does it matter that some of the cells on sheet1 will be duplicates?
Thanks
I have a list of countries in cells a2:a12 on sheet1 (some are duplicates) that i would like to use as my search criteria.
I have a range of data on sheet2 b2:g200, column B contains available countries.
How can i filter B by my multiple criteria cells?
the below is what i started working with but i can't get my different criteria to group together when filtered. the below leaves me with an empty filter.
Does it matter that some of the cells on sheet1 will be duplicates?
Thanks
Code:
Sub DoFilter()
Dim rCrit1 As Range, rCrit2 As Range, rRng1 As Range, rRng2 As Range
With Application
.EnableEvents = False
.ScreenUpdating = False
End With
Set rCrit1 = Worksheets("Summary").Range("A2")
Set rCrit2 = Worksheets("Summary").Range("A3")
Set rRng1 = Worksheets("Funds").Range("B2:G208")
Set rRng2 = Worksheets("Funds").Range("B3:G208")
With rRng1
.AutoFilter field:=1, Criteria1:=rCrit1.Value, Operator:=xlOr
.AutoFilter field:=1, Criteria2:=rCrit2.Value
rRng2.SpecialCells(xlCellTypeVisible).EntireRow.Copy
.AutoFilter
End With
Application.EnableEvents = True
End Sub
Last edited: