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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
| Private Sub Combobox1_change()
Dim DerLgn As Byte
Dim L As Byte, Idx As Byte
With Worksheets("Carte")
DerLgn = .Cells(.Rows.Count, 1).End(xlUp).Row
For L = 2 To DerLgn
Idx = .Cells(L, 1)
Controls("Label" & Idx).Caption = .Cells(L, 2)
Controls("Label" & Idx).AutoSize = False
Controls("Label" & Idx).Width = 60
Controls("Label" & Idx).Height = 10
Controls("Label" & Idx).Font.Bold = True
Controls("Label" & Idx).TextAlign = fmTextAlignLeft
'Controls("Label" & Idx).Size = 11
If .Cells(Idx, 3) = "" Then '
Controls("Label" & Idx).Visible = False
Else
If .Cells(Idx, 6) = "" Then '
Controls("Label" & Idx).BackColor = RGB(255, 255, 255) 'blanc
Else
If .Cells(Idx, 6) >= 0.5 Then
Controls("Label" & Idx).BackColor = RGB(0, 255, 64) 'vert
Controls("LblDmd").BackColor = RGB(0, 255, 64)
Controls("LblDmd").ForeColor = RGB(0, 0, 0)
Else
If .Cells(Idx, 4) < 1 Then
Controls("Label" & Idx).BackColor = RGB(234, 70, 40) 'rouge
Controls("Lblref").BackColor = RGB(234, 70, 40)
Controls("Lblref").ForeColor = RGB(0, 0, 0)
Else
If .Cells(Idx, 4) = 1 Then
Controls("Label" & Idx).BackColor = RGB(68, 202, 203) 'bleu
Controls("Lblacc").BackColor = RGB(68, 202, 203)
Controls("Lblacc").ForeColor = RGB(0, 0, 0)
End If
End If
End If
End If
End If
Next L
End With
Me.LblChoixcerem.BackColor = RGB(255, 255, 255)
Me.ComboBox1.BackColor = RGB(255, 255, 255)
Sheets("carte").Range("H1") = ComboBox1.Value
End Sub |
Partager