Iam creating my labels and checkbox by code:
i = 1
While Not Sheets("I_M_1_1PW").Cells(9 + i, 43) = "koniec"
Set theLabel = UserForm1.Controls.Add("Forms.Label.1", labelCounter, True)
With theLabel
.Caption = Sheets("I_M_1_1PW").Cells(9 + i, 43)
.Left = 10
.Width = 100
.Top = 13 * labelCounter
Debug.Print labelCounter & " " & theLabel.Caption
End With
Set chkbox = UserForm1.Controls.Add("Forms.CheckBox.1", "CheckBox_" & i)
chkbox.Caption = Sheets("I_M_1_1PW").Cells(9 + i, 44)
chkbox.Left = 100
chkbox.Width = 75
chkbox.Top = 13 * labelCounter
i = i + 1
labelCounter = labelCounter + 1
I can search for active check box by code:
For j = 1 To Granica - 1
If UserForm1.Controls("CheckBox_" & j).Value = True Then
Wynik1 = UserForm1.Controls("CheckBox_" & j).Caption + Wynik1
'* Wzorce = Wzorce + UserForm1.label(j).Caption
End If
Next
But in '* place i got problem, cant take label.caption when iam using UserForm1.Controls(j).Caption its looping through all parts parts of user.form not only labels.
UserForm1.Controls.Add("Forms.Label.1", "label_" & labelCounter, True).