Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Alternating colors in a listbox

Status
Not open for further replies.

stali

IS-IT--Management
Jun 14, 2001
2
US
Is there a way to set the rows of a listbox to a different color just on a specific condition? For example, I build a list box where one column is the difference in charges for 2 months. If the difference is negative, I want to set that one row & column to red. I tried the below code, but no luck. Any suggestions?

Set ListBox = PctForm.LatestMonth
ListCount = ListBox.ListCount
For intI = 0 To ListCount - 1
If ListBox.Column(3, intI) < 0 Then
ListBox.ForeColor = vbRed
Else
ListBox.ForeColor = vbBlue
End If
Next

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top