Listbox color format

jsartain

New Member
Joined
Mar 24, 2002
Messages
24
Does anyone know how to change a listboxes' text color in code? I am trying to change the color of the listbox based on a condition.

For example

Sub OptionButton1.Change()

Y = Worksheets("Sheet1").Range("A1")

If Y = "Yes" Then
Listbox1.Clear
Listbox1.additem "Yes"
Else
Listbox1.Clear
Listbox1.additem "No"
End If

End Sub

I would like the listbox to show the "Yes" and "No" in different colors. Is there a format function to change this [i.e. additem format("Yes",?)]?

Thanks for the help.
 

Some videos you may like

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".

Watch MrExcel Video

Forum statistics

Threads
1,119,002
Messages
5,575,491
Members
412,669
Latest member
nickyon1
Top