Dear all,
I have created an excel userform with some comboboxes, attached a document with the problem but stripped down to the basic problem.
I figured out how i can filter/autoupdate my comboboxes and decrease the input list while i start typing in the list. However as soon as i select an item i get the following error: "Unable to get the CurrentRegion property of the Range class".
Since i want to apply this feature to all comboboxes on my userforms i have put everything in a class event.
I have already found some stuff online but these were basically comboboxes on a worksheet.
Thank you very much!
Best Regards, Marcel
combobox_filter.xlsm
Option Explicit
Public WithEvents myCBox As msForms.ComboBox
Dim data As Range
Private Sub myCBox_Change()
Set data = filter.Cells(1, 1).CurrentRegion
' filter.Activate
With myCBox
.DropDown
' FILTER
list.Cells(1, 1).CurrentRegion.AutoFilter Field:=1, Criteria1:="*" & .Value & "*"
' COPY
filter.Cells.Clear
list.Cells(1, 1).CurrentRegion.Copy Destination:=filter.Cells(1, 1)
Set data = filter.Cells(1, 1).CurrentRegion
num_rows_2 = data.Rows.Count
' UPDATE COMBOBOX
.RowSource = "filter!A2:A" & num_rows_2
End With
End Sub
Bookmarks