Public Sub Filter1()
Dim rng As Range
Dim iCol As Integer
Select Case parameter1
Case "Yes"
iCol = 1
Case "No"
iCol = 2
End Select
Range("A1").Select
Set rng = ActiveSheet.UsedRange
Selection.AutoFilter
rng.AutoFilter Field:=iCol, Criteria1:=parameter1
End Sub
Code:Public Sub Filter1() Dim rng As Range Dim iCol As Integer Select Case parameter1 Case "Yes" iCol = 1 Case "No" iCol = 2 End Select Range("A1").Select Set rng = ActiveSheet.UsedRange Selection.AutoFilter rng.AutoFilter Field:=iCol, Criteria1:=parameter1 End Sub
My main query does a whole lot of other stuff but I want to primitively filter the query based on the conditions of a cell that the user selects from a drop down. I've already created the parameter queries that feeds into my main query to get the selections but I'm stuck on being able to filter my main query based on the cell selection. I hope this makes more sense, thanks.if you have a query, you wont need the code.