Hello all,
I got a combobox on my userform named cboxFunctionSearch
This combobox is filled with the following code;
Now i try to make a reset button to reset this combobox after searching since in some cases the data in it disapear
I made a button and added the following code;
It crashes on addIfUnique, i think it's because it's a public sub?
How do i run above code to make this reset button work?
I got a combobox on my userform named cboxFunctionSearch
This combobox is filled with the following code;
Code:
Private Sub Init_cboxFunctionSearch()Dim X As Integer
With Me.cboxFunctionSearch
.Clear
.AddItem "All"
For X = 0 To Me.lstSearchResults.ListCount - 1
Call addIfUnique(cboxFunctionSearch, CStr(Me.lstSearchResults.List(X, 3)))
Next X
.value = "All"
End With
End Sub
Public Sub addIfUnique(CB As ComboBox, value As String)
If CB.ListCount = 0 Then GoTo doAdd
Dim i As Integer
For i = 0 To CB.ListCount - 1
If LCase(CB.List(i)) = LCase(value) Then Exit Sub
Next
doAdd:
CB.AddItem value
End Sub
Now i try to make a reset button to reset this combobox after searching since in some cases the data in it disapear
I made a button and added the following code;
Code:
Private Sub cbtnReset_Click()
UserForm_Initialize
Init_cboxFunctionSearch
addIfUnique
End Sub
It crashes on addIfUnique, i think it's because it's a public sub?
How do i run above code to make this reset button work?