Dim a, i As Long, ii As Long, b(), n As LongListBox1.Clear
With ComboBox1
If .Text = "" Then Exit Sub
If WorksheetFunction.CountIf(Worksheets("list").Range("a:a"), .Text) = 0 Then
Exit Sub
End If
a = Worksheets("list").Range("a1").Resize(Worksheets("list").Range("a" & Rows.Count).End(xlUp).Row, 37).Value
For i = 1 To UBound(a, 1)
If a(i, 1) = .Text Then
n = n + 1: ReDim Preserve b(1 To 37, 1 To n)
For ii = 1 To UBound(a, 2)
b(ii, n) = a(i, ii)
Next
End If
Next
End With
With ListBox1
.ColumnCount = 37
.ColumnWidths = "0;0;150;42;42;42;42;42;42;42;42;42;42;42;42;42;42;42;42;42;42;42;42;42;42;42;42;42;42;42;42;42;42;42;0;0;0"
.Column = b
End With
With Application
Me.TextBox6.Value = .CountIf(.Index(b, 0, 3), "S")
End With