Posts

Showing posts from August, 2019

Build Searchable Dropdown Control using ComboBox and ListBox

Steps to achieve this control Step 1: Insert an Userform Step 2: Insert TextBox from Toolbar Step 3: Insert ListBox from Toolbar Step 6: Write Few names in Sheet1 in column 1 Step 7: Insert a button on a worksheet and write the following code to it. Private Sub CommandButton1_Click()     UserForm1.Show End Sub Step 4: Change ListBox Heigh to 0 from Properties window. Step 5: Copy Following Code Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)          MsgBox Me.ListBox1.List(Me.ListBox1.ListIndex)      End Sub Private Sub TextBox1_Change()          Dim I As Long, tmp As String, arr() As String     Dim J As Long, ArrCount As Long, K As Long          With Me.ListBox1         .Clear         .Height = 0     End With          If Me.TextBox1.Value = vbNullString Then Exit Sub          tmp = vbNullString     ArrCount = 0          'Filling the Array with Values which matches the criteria     With Sheet1         J = .Cells(.Rows