1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| Private Sub CommandButton1_Click()
Unload Me
End Sub
Private Sub ListBox1_Click()
Dim Sh As Worksheet
For i = 5 To 8
Me.Controls("Label" & i).BackColor = -2147483633
Next i
For Each Sh In Sheets
If Sh.Cells(Me.ListBox1.ListIndex + 4, 5) = "1" Then
Me.Controls("Label" & Sh.Index + 3).BackColor = RGB(0, 255, 0)
ElseIf Sh.Cells(Me.ListBox1.ListIndex + 4, 5) = "0" Then
Me.Controls("Label" & Sh.Index + 3).BackColor = RGB(255, 0, 0)
End If
Next Sh
End Sub
Private Sub UserForm_Click()
MsgBox Me.Label5.BackColor
End Sub
Private Sub UserForm_Initialize()
Me.ListBox1.List = [Feuille1!A4:A15].Value
End Sub |
Partager