Hi pells
Sorry, I misunderstood. I didn't clean the code up but something like this may work for you
Private Sub CommandButton1_Click()
'SEARCH
Dim Cnt As Long
Dim Col As Variant
Dim FirstAddx As String
Dim FoundMatch As Range
Dim LastRow As Long
Dim R As Long
Dim StartRow As Long
Dim Wks As Worksheet
Dim rng As Range
Dim C As Range
Dim SearchRecords As Long
Dim i As Long
Dim colCnt As Long
StartRow = 4
If TextBox1.Text = "" Then
MsgBox "Please enter a search term."
TextBox1.SetFocus
Exit Sub
End If
Set Wks = ActiveWorkbook.Sheets("Live Job List")
colCnt = Wks.Cells(4, Columns.Count).End(xlToLeft).Column
For i = 1 To colCnt
Col = i
LastRow = Wks.Cells(Rows.Count, Col).End(xlUp).Row
LastRow = IIf(LastRow < StartRow, StartRow, LastRow)
Set rng = Wks.Range(Wks.Cells(1, Col), Wks.Cells(LastRow, Col))
Set FoundMatch = rng.Find(What:=TextBox1.Text, _
After:=rng.Cells(1, 1), _
LookAt:=xlPart, _
LookIn:=xlValues, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not FoundMatch Is Nothing Then
FirstAddx = FoundMatch.Address
ListView1.ListItems.Clear
Do
Cnt = Cnt + 1
R = FoundMatch.Row
ListView1.ListItems.Add Index:=Cnt, Text:=Wks.Cells(R, 1)
For Col = 2 To 3
Set C = Wks.Cells(R, Col)
ListView1.ListItems(Cnt).ListSubItems.Add Index:=Col - 1, Text:=C.Text
Next Col
Set FoundMatch = rng.FindNext(FoundMatch)
Loop While FoundMatch.Address <> FirstAddx And Not FoundMatch Is Nothing
SearchRecords = Cnt
Else
' ListView1.ListItems.Clear
' SearchRecords = 0
' MsgBox "No match found for " & TextBox1.Text
End If
Next i
End Sub
Bookmarks