I have found this code on another question here and have found it works well for searching based on the first column. I'm not sure how to change the code so it searches column "U" yet retains the F to AS column range. Any assistance is greatly appreciated
Private Sub ComboBox3_Change()
Userform1.ListBox1.Clear
Dim shData As Worksheet
Set shData = ThisWorkbook.Sheets("Dispatch")
Dim rng As Range
Set rng = shData.Range("F3:AS" & shData.Range("F" & shData.Rows.Count).End(xlUp).Row)
Dim recordCount As Long
recordCount = Application.CountIf(rng.Columns(1), Me.ComboBox3.Value)
If recordCount = 0 Then Exit Sub
Dim filteredData() As Variant
ReDim filteredData(1 To recordCount, 1 To rng.Columns.Count)
Dim i As Long
Dim j As Long
Dim numRows As Long
numRows = 0
For i = 1 To rng.Rows.Count
If rng.Cells(i, 1).Value = Userform1.ComboBox3.Value Then
numRows = numRows + 1
For j = 1 To rng.Columns.Count
filteredData(numRows, j) = rng.Cells(i, j).Value
Next j
End If
Next i
With Userform1.ListBox1
If numRows > 0 Then
.ColumnCount = rng.Columns.Count
.ColumnWidths = "130;1;1;80;70;60;1;60;1;1;1;30;40;1;100;75;35;35;60;60;60;40;1;100;1;1;1;1;1;1;1;50;1;1;1;1"
.List = filteredData
.TopIndex = 0
End If
End With
End Sub
Private Sub ComboBox3_Change()
Userform1.ListBox1.Clear
Dim shData As Worksheet
Set shData = ThisWorkbook.Sheets("Dispatch")
Dim rng As Range
Set rng = shData.Range("F3:AS" & shData.Range("F" & shData.Rows.Count).End(xlUp).Row)
Dim recordCount As Long
recordCount = Application.CountIf(rng.Columns(1), Me.ComboBox3.Value)
If recordCount = 0 Then Exit Sub
Dim filteredData() As Variant
ReDim filteredData(1 To recordCount, 1 To rng.Columns.Count)
Dim i As Long
Dim j As Long
Dim numRows As Long
numRows = 0
For i = 1 To rng.Rows.Count
If rng.Cells(i, 1).Value = Userform1.ComboBox3.Value Then
numRows = numRows + 1
For j = 1 To rng.Columns.Count
filteredData(numRows, j) = rng.Cells(i, j).Value
Next j
End If
Next i
With Userform1.ListBox1
If numRows > 0 Then
.ColumnCount = rng.Columns.Count
.ColumnWidths = "130;1;1;80;70;60;1;60;1;1;1;30;40;1;100;75;35;35;60;60;60;40;1;100;1;1;1;1;1;1;1;50;1;1;1;1"
.List = filteredData
.TopIndex = 0
End If
End With
End Sub