Check the below code for details to know where to add the suggested code...
![]()
Private Sub UserForm_Initialize() Dim rRng As Range, r As Range, rSortCr As String Set rRng = Sheet2.Range("a2:a5567") rSortCr = UCase(ActiveCell.Value) For Each r In rRng If InStr(UCase(r), rSortCr) Then Me.ListBox1.AddItem r.Value Next r If Me.ListBox1.ListCount = 1 Then Me.ListBox1.ListIndex = 0 Selection.Value = Me.ListBox1.Value End If End Sub
Bookmarks