wali,
From the Forum Rules:
4. Don't Private Message or email questions to moderators or other members. The point of having a public forum is to share solutions to common (and sometimes uncommon) problems with all members.

Originally Posted by
wali
I took a look at your file, and got the makeResultActive button working. Had to make a couple of changes to cmdSearch_Click():
Private Sub cmdSearch_Click()
Dim wrk As Workbook
Dim ws As Worksheet
Dim wsTemp As Worksheet
Dim varSearchString As String
Dim varRow As Long
Dim LR As Long
Dim LR1 As Long
If Me.txtSearchString.Text = "" Then
MsgBox "Please enter a search term.", vbCritical
Exit Sub
End If
Application.ScreenUpdating = False
Me.lstResults.RowSource = ""
Set wrk = ActiveWorkbook
Set wsTemp = Sheets("tmpSearch")
wsTemp.Range("A2:B50000").Clear
For Each ws In wrk.Worksheets
If ws.Name <> wsTemp.Name And ws.Name <> "ps-de" Then
LR = ws.Range("A" & Rows.Count).End(xlUp).Row
varSearchString = LCase(Me.txtSearchString.Text)
For varRow = 1 To LR
On Error Resume Next
If InStr(LCase(ws.Cells(varRow, 1).Value), varSearchString) <> 0 Then
LR = wsTemp.Range("A" & Rows.Count).End(xlUp).Row
wsTemp.Range("A" & LR).Offset(1, 0).Value = ws.Cells(varRow, 1).Value
wsTemp.Range("A" & LR).Offset(1, 1).Value = ws.Name
End If
On Error GoTo 0
Next varRow
End If
Next ws
With wsTemp
.Columns("A:A").EntireColumn.AutoFit
End With
Application.ScreenUpdating = True
If wsTemp.Range("A2").Value = "" Then
MsgBox "No results found.", vbInformation
Else
Me.lstResults.ColumnWidths = wsTemp.Columns(1).Width
Me.lstResults.RowSource = "=OFFSET(tmpSearch!$A$2,0,0,COUNTA(tmpSearch!$A$2:$A$65000),1)"
End If
End Sub
And here's the code for makeResultActive_Click()
Private Sub makeResultActive_Click()
If Me.lstResults.ListIndex = -1 Then Exit Sub
With Sheets(Sheets("tmpSearch").Range("B" & Me.lstResults.ListIndex + 2).Value)
.Select
.Cells.Find(What:=Sheets("tmpSearch").Range("A" & Me.lstResults.ListIndex + 2).Value, LookAt:=xlWhole).Select
End With
End Sub
Bookmarks