Hallo everyone,
I have a userform which has a textbox "txtSearchString". When I type a string in it and click Button "cmdSearch", it looks for the typed word in all worksheets and shows me the results in a Listbox "lstResults".
Now I want to select one of the results and jump to that cell (which contains the selected result from Listbox) by clicking the button "makeResultActive".
I will be thankful if someone could help me in writing code for the button "makeResultActive".
I already have two other buttons for other puposes which do their job well. Now I need code for the next button "makeResultActive".
Private Sub CommandButton3_Click()
'this Button copys the selected result from the resultlist of listbox "lstResults"
Dim i As Integer
Dim LR As Long
LR = Sheets("de-ps").Range("A" & Rows.Count).End(xlUp).Row + 1
With lstResults
For i = 0 To .ListCount - 1
If .Selected(i) Then
Sheets("de-ps").Range("A" & LR).Value = .List(i)
LR = LR + 1
End If
Next i
End With
End Sub
Private Sub CommandButton4_Click()
' this Button replaces content of active Cell through selected result from lstResults
Dim i As Integer
Dim LR As Long
With lstResults
For i = 0 To .ListCount - 1
If .Selected(i) Then
ActiveCell.Value = Me.lstResults.Value
'Sheets("de-ps").Range("A" & LR).Value = .List(i)
LR = LR + 1
End If
Next i
End With
End Sub
Private Sub makeResultActive_Click()
'when clicked it should make cell of selected result from lstResults active/jumb there
End Sub
Thanks for each help in advance.
Bookmarks