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 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
|
Private Sub UserForm_Initialize()
Dim New_Text_box As Object
Dim F_Trait As Object
Dim Usf As Object
Dim obj As Control
Dim Cl As Classe_Label
Set collect = New Collection
Set F_Trait = ThisWorkbook.Sheets("Disponibilité")
Dis_Det_Mois.Label2.Caption = F_Trait.Cells(1, 5).Value & " " & F_Trait.Cells(1, 10).Value
For i = 2 To F_Trait.UsedRange.Rows.Count
For j = 1 To F_Trait.UsedRange.Columns.Count
If F_Trait.Cells(i, j).Value <> "" Then
Set obj = Dis_Det_Mois.Controls.Add("Forms.Label.1")
With obj
'.Object.Caption = i
.TextAlign = 2
.Left = 1 + (j * 20)
.Top = 2 + (i * 15)
.Width = 20
.Height = 20
.BorderStyle = 1
End With
If F_Trait.Cells(i, j).Value = "N" Then
obj.BackColor = vbRed
Else
obj.BackColor = &HF8D2F9
End If
If j = 1 Then
obj.Caption = F_Trait.Cells(i, 1).Value
obj.BackColor = vbMagenta
End If
If i = 2 Then
obj.Caption = Format(F_Trait.Cells(i, j).Value, "DD")
obj.BackColor = vbCyan
End If
Set Cl = New Classe_Label
Set Cl.tb = obj
collect.Add Cl
End If
Next
Next
If i > 40 Then Dis_Det_Mois.ScrollHeight = 600 + (i * 20)
End Sub |
Partager