I have this code in my userform's listbox.
I find that I have to press Enter twice in order for it to trigger the event. Any ideas why that would be? I've checked and the problem is not caused by other events firing first.Code:Private Sub lstFrom_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer) Dim lngEntry As Long Dim bMatched As Boolean If KeyCode = vbKeyReturn Then For lngEntry = 0 To lstFrom.ListCount - 1 If UCase(txtSearch) = UCase(lstFrom.List(lngEntry)) Then lstFrom.Selected(lngEntry) = True bMatched = True End If Next End If If Not bMatched Then MsgBox "'" & txtSearch & "' not found in the From list" End If End Sub




Reply With Quote
