Hi Good People,
I' wondering if this is possible for listview, did my research but I can't seem to find the solution for this one. Hoping someone can guide me on this.. So I'm currently working a project that requires to update a listview data base on a combo box. However, Im getting an error of 'index out of bounds'
Below is my code.
Also, i have a condition to change the forecolor of the list items whenever the condition is met but this is giving me an error as well.
This is working, however, whenever I try to change the combo box. It's not functioning..
Thanks in Advance guys.. =(
I' wondering if this is possible for listview, did my research but I can't seem to find the solution for this one. Hoping someone can guide me on this.. So I'm currently working a project that requires to update a listview data base on a combo box. However, Im getting an error of 'index out of bounds'
Below is my code.
VBA Code:
Dim i As Long
Dim CN as Integer
For i = 3 to Sheets("Team H").range("A30000").end(xlUp).row
Listview1.ListItems.Add , , i - 2
CN = CN + 1
If combox1.value = "sep" then
Listview1.listitems(CN).listsubitems.add , , Sheets("Team H").cells(i , "A")
Listview1.listitems(CN).listsubitems.add , , Sheets("Team H").cells(i , "B")
End If
Next i
Dim q As Long
Dim CN2 as Integer
For q = 3 to Sheets("Team H").range("N30000").end(xlUp).row
Listview1.ListItems.Add , , q - 2
CN2 = CN2 + 1
If combox1.value = "oct" then
Listview1.listitems(CN2).listsubitems.add , , Sheets("Team H").cells(i , "N")
Listview1.listitems(CN2).listsubitems.add , , Sheets("Team H").cells(i , "O")
End If
Next q
Also, i have a condition to change the forecolor of the list items whenever the condition is met but this is giving me an error as well.
VBA Code:
Dim x As Integer
Dim RNG As Variant
For x = 1 to Listview.Listitems.count
Set RNG = Listview1.ListItems(X)
For c = 4 to 4
If Val(RNG.ListSubItems(4)) < 95 then
listview1.listItems(x).listsubitems(c).forecolor = &HFF&
End if
Next c
Next x
This is working, however, whenever I try to change the combo box. It's not functioning..
Thanks in Advance guys.. =(