I am trying to create a userform that has all the fields highlighted until a user makes a selection. I have been trying to do this by changing the border color from red to gray with a change event, but it isn't working.
I can change the listbox formatting with a UserForm_Initialize
Private Sub UserForm_Initialize()
'code...
With ListBox1
.BorderStyle = fmBorderStyleSingle
.BorderColor = &HFF&
.BackColor = &HFF&
End With
'some more code...
End Sub
This works. But when I use a listbox click or change event, it does nothing.
'This does nothing
Private Sub ListBox1_Change()
With ListBox1
.BorderStyle = fmBorderStyleSingle
.BorderColor = &H80000006
.BackColor = vbWhite
End With
End Sub
'This also does nothing
Private Sub ListBox1_Click()
'code that does work
'This does nothing
With ListBox1
.BorderStyle = fmBorderStyleSingle
.BorderColor = &H80000006
.BackColor = vbWhite
End With
End Sub
Can anyone point out what I am doing wrong? Why can I change the format of the listbox on initialize, but not on a change or click event?
Bookmarks