Basically Searching in Change Event does not allow Click_Event To run Smoothly. Don't Know Why.
By Clicking on Value in ComboBox1_click event to get the Row Works Perfect but COMPLETELY without Change_Event. Incorporated Change_Event to Search a value from Column A and to Select the Row.
So Want to get the Row Number with ComboBox_Change event and simultaneoulsy with ComboBox_Click event
NimishK
By Clicking on Value in ComboBox1_click event to get the Row Works Perfect but COMPLETELY without Change_Event. Incorporated Change_Event to Search a value from Column A and to Select the Row.
So Want to get the Row Number with ComboBox_Change event and simultaneoulsy with ComboBox_Click event
Code:
Private Sub UserForm_Initialize()
ComboBox1.List = Worksheets("Sheet1").Range("A2").CurrentRegion.Offset(1).Value
End Sub
Private Sub ComboBox1_Click()
Dim curRow As Long
curRow = ComboBox1.ListIndex + 2
If idx <> -1 Then
Worksheets("Sheet1").Rows(curRow).Select
End If
End Sub
Private Sub ComboBox1_Change()
Dim i As Long
With ComboBox1
If Not IsArrow Then
.List = Worksheets("Sheet1").Range("A2").CurrentRegion.Offset(1).Value
If .ListIndex = -1 And Len(.Text) Then
For i = .ListCount - 1 To 0 Step -1
If InStr(1, .List(i), .Text, 1) = 0 Then .RemoveItem i
Next i
.DropDown
End If
End If
If Me.ComboBox1.ListCount = 0 Then MsgBox "Sorry Not Found"
End With
End Sub
Private Sub ComboBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
IsArrow = KeyCode = vbKeyUp Or KeyCode = vbKeyDown
If KeyCode = vbKeyReturn Then ComboBox1.List = Worksheets("Sheet1").Range("A2").CurrentRegion.Offset(,1).Value
End Sub
Last edited: