Color the rows in a multi-column listbox
hich24
Posted messages
1686
Status
Membre
-
cs_Le Pivert Posted messages 8437 Status Contributeur -
cs_Le Pivert Posted messages 8437 Status Contributeur -
Hello,
I have a multi-column list box (18 columns) that gathers records from the Excel sheet,
I want to color all the rows provided that the value in column 5 is empty
Thank you in advance my dear respects.
I have a multi-column list box (18 columns) that gathers records from the Excel sheet,
I want to color all the rows provided that the value in column 5 is empty
Thank you in advance my dear respects.
2 réponses
Hello,
Like this:
Test done with Search for a word in a BD of Boisgontier
http://boisgontierjacques.free.fr/pages_site/formulaireListes2colonnes.htm#RechIntuitif
@+ The Woodpecker
Like this:
Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean) With Sheets("BD") 'adapt sheet name If Application.CountA(Range("E2:E" & Range("A65536").End(xlUp).Row)) = 0 Then 'E2 if header ListBox1.ForeColor = RGB(255, 0, 0) 'red Else ListBox1.ForeColor = RGB(0, 0, 0) 'black End If End With End Sub Test done with Search for a word in a BD of Boisgontier
http://boisgontierjacques.free.fr/pages_site/formulaireListes2colonnes.htm#RechIntuitif
@+ The Woodpecker
hich24
Posted messages
1686
Status
Membre
753
Thank you for your help, it works but it colors the entire list box so I only want to have the rows that have the value in column 5 empty.
To do this, you need to go through a ListView:
https://silkyroad.developpez.com/VBA/ListView/
--
@+ The Woodpecker
https://silkyroad.developpez.com/VBA/ListView/
--
@+ The Woodpecker