asyamonique
Well-known Member
- Joined
- Jan 29, 2008
- Messages
- 1,284
- Office Version
- 2013
- Platform
- Windows
Code:
Private Sub CommandButton3_Click()
Dim r As Long
If ComboBox1.Value <> -1 And ComboBox2.Value <> -1 Then
ListBox1.Clear
With Worksheets("list").Range("A1:A30000")
For r = 1 To .Rows.Count
If ComboBox1.Value = .Cells(r, 1).Value And ComboBox2.Value = .Cells(r, 2).Value Then
ListBox1.AddItem .Cells(r, 1).Value
ListBox1.list(ListBox1.ListCount - 1, 1) = .Cells(r, 2).Value
ListBox1.list(ListBox1.ListCount - 1, 2) = .Cells(r, 3).Value
ListBox1.list(ListBox1.ListCount - 1, 3) = .Cells(r, 4).Value
ListBox1.list(ListBox1.ListCount - 1, 4) = .Cells(r, 5).Value
ListBox1.list(ListBox1.ListCount - 1, 5) = .Cells(r, 6).Value
ListBox1.list(ListBox1.ListCount - 1, 6) = .Cells(r, 7).Value
ListBox1.list(ListBox1.ListCount - 1, 7) = .Cells(r, 8).Value
ListBox1.list(ListBox1.ListCount - 1, 8) = .Cells(r, 9).Value
ListBox1.list(ListBox1.ListCount - 1, 9) = .Cells(r, 10).Value
ListBox1.list(ListBox1.ListCount - 1, 10) = .Cells(r, 11).Value
ListBox1.list(ListBox1.ListCount - 1, 11) = .Cells(r, 12).Value
ListBox1.list(ListBox1.ListCount - 1, 12) = .Cells(r, 13).Value
ListBox1.list(ListBox1.ListCount - 1, 13) = .Cells(r, 14).Value
ListBox1.list(ListBox1.ListCount - 1, 14) = .Cells(r, 15).Value
ListBox1.list(ListBox1.ListCount - 1, 15) = .Cells(r, 16).Value
ListBox1.list(ListBox1.ListCount - 1, 16) = .Cells(r, 17).Value
ListBox1.list(ListBox1.ListCount - 1, 17) = .Cells(r, 18).Value
ListBox1.list(ListBox1.ListCount - 1, 18) = .Cells(r, 19).Value
ListBox1.list(ListBox1.ListCount - 1, 19) = .Cells(r, 20).Value
ListBox1.list(ListBox1.ListCount - 1, 20) = .Cells(r, 21).Value
ListBox1.list(ListBox1.ListCount - 1, 21) = .Cells(r, 22).Value
ListBox1.list(ListBox1.ListCount - 1, 22) = .Cells(r, 23).Value
ListBox1.list(ListBox1.ListCount - 1, 23) = .Cells(r, 24).Value
ListBox1.list(ListBox1.ListCount - 1, 24) = .Cells(r, 25).Value
ListBox1.list(ListBox1.ListCount - 1, 25) = .Cells(r, 26).Value
ListBox1.list(ListBox1.ListCount - 1, 26) = .Cells(r, 27).Value
ListBox1.list(ListBox1.ListCount - 1, 27) = .Cells(r, 28).Value
ListBox1.list(ListBox1.ListCount - 1, 28) = .Cells(r, 29).Value
ListBox1.list(ListBox1.ListCount - 1, 29) = .Cells(r, 30).Value
ListBox1.list(ListBox1.ListCount - 1, 30) = .Cells(r, 31).Value
ListBox1.list(ListBox1.ListCount - 1, 31) = .Cells(r, 32).Value
ListBox1.list(ListBox1.ListCount - 1, 32) = .Cells(r, 33).Value
ListBox1.list(ListBox1.ListCount - 1, 33) = .Cells(r, 34).Value
ListBox1.list(ListBox1.ListCount - 1, 34) = .Cells(r, 35).Value
ListBox1.list(ListBox1.ListCount - 1, 35) = .Cells(r, 36).Value
End If
Next r
End With
With ListBox1
.ColumnCount = 35
.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;42"
End With
End If
End Sub
Good Day,
Could someone help me on that given code above?
Its not running after
Code:
ListBox1.list(ListBox1.ListCount - 1, 10) = .Cells(r, 11).Value
Many thanks