I want to place a combo box above an “Issue Status” column to filter the whole sheet based on the value selected from this column. Ideally, the combo box would have three options–“Open”, “Closed”, and “Any”.
How can I go about doing this?
I tried the following code:
Private Sub ComboBox1_Change()
Dim sFilter As String
sFilter = ActiveSheet.DropDowns(Application.Caller).List(ActiveSheet.DropDowns(Application.Caller).Value)
On Error Resume Next
ActiveSheet.AutoFilterMode = False
ActiveSheet.UsedRange.AutoFilter 1, sFilter
End Sub
However, this is throwing an error: Run-time error 1004: Unable to get the DropDowns property of the worksheet class.
Also, it is listing values several times in the combo box. For example, index 1 of the combo box = “Open”, index 2 also = “Open”, etc. I want to only display distinct values and filter based on that.
Is there a better approach to this? What am I doing wrong?
Just use a filter, Data>Filter.