ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   problems resetting backcolor in listbox (https://www.excelbanter.com/excel-programming/315476-problems-resetting-backcolor-listbox.html)

Kelley[_3_]

problems resetting backcolor in listbox
 
I have a userform to allow the user to select the period to view. He
can either select a month or a quarter to view. I have two listboxes,
one for the months - lstMonths and one for the quarters - lstQuarters.
What I'd like to have happen is that when he clicks into one listbox,
the other box grays out. I'm trying to do it like this:

Private Sub lstMonth_Click()

lstMonth.BackColor = &H80000005 'White

lstQuarter.ListIndex = -1
lstQuarter.BackColor = &H8000000F 'Grey

End Sub

Private Sub lstQuarter_Click()

lstQuarter.BackColor = &H80000005 'White

lstMonth.ListIndex = -1
lstMonth.BackColor = &H8000000F 'Grey

End Sub

When the userform comes up the first time, both boxes have a white
background. When I click on one of them, the other one does go gray.
But when I click on the other one, both of them are grey and they stay
that way.

Any ideas?


All times are GMT +1. The time now is 06:18 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com