Hi,
I have a code for a filter see below:
I would like to change filterConditions so that is also looks at data in column B.
So code would change to something like
But this does not work.
Can someone please let me know how I can add additional condition
?
Thanks,
N.
I have a code for a filter see below:
VBA Code:
Sub ApplyFilter()
Dim filterRange As Range
Dim filterConditions As Range
'Set the filter range and conditions range
Set filterRange = Sheets("Sheet2").Range("A4:G20")
Set filterConditions = Sheets("Sheet1").Range("A5:A" & Sheets("Sheet1").Cells(Rows.Count, "A").End(xlUp).Row)
'Apply the filter based on the conditions in Sheet1
filterRange.AutoFilter Field:=4, Criteria1:=Application.Transpose(filterConditions), Operator:=xlFilterValues
End Sub
I would like to change filterConditions so that is also looks at data in column B.
So code would change to something like
VBA Code:
Set filterConditions = Sheets("Sheet1").Range("A5:A" & Sheets("Sheet1").Cells(Rows.Count, "A").End(xlUp).Row) & Sheets("Sheet1").Range("B5:B" & Sheets("Sheet1").Cells(Rows.Count, "B").End(xlUp).Row)[/B]
But this does not work.
Can someone please let me know how I can add additional condition
VBA Code:
Set filterConditions = Sheets("Sheet1").Range("B5:B" & Sheets("Sheet1").Cells(Rows.Count, "B").End(xlUp).Row)
Thanks,
N.