Current Code Works Perfectly!!! However, the idiots who designed the excel sheet (I have no control over this) Decided it would be funny to double, triple and even quadrupedal the results maybe even higher than that not sure.... There are 28000+ Lines/Rows.... However.. I only need the first 3 Results... LOL... How can I get the macro to stop after 3 Rows are filled.... So my list box looks much nicer....
Thanks!!!
VBA Code:
Private Sub CommandButton9_Click()
On Error GoTo Terminate
Dim rng As Range
Dim Cel1 As Range
Dim LR As Long
Dim ws As Worksheet
Set ws = Sheets("Rates")
With ws
LR = .Cells(.Rows.Count, "D").End(xlUp).Row
Set rng = .Range("D1:D" & LR).SpecialCells(xlCellTypeVisible)
With Me.ListBox1
.ColumnCount = 5 '
For Each Cel1 In rng
.AddItem CStr(Cel1.Value)
.List(.ListCount - 1, 1) = Cel1.Offset(0, 5).Value
.List(.ListCount - 1, 2) = Cel1.Offset(0, 6).Value
.List(.ListCount - 1, 3) = Cel1.Offset(0, 7).Value
.List(.ListCount - 1, 4) = Cel1.Offset(0, 8).Value
.List(.ListCount - 1, 5) = Cel1.Offset(0, 9).Value
.List(.ListCount - 1, 6) = Cel1.Offset(0, 10).Value
Next Cel1
End With
End With
Exit Sub
Terminate:
ListBox1.Clear
Error.Show
End Sub
Thanks!!!