- Katılım
- 14 Kasım 2017
- Mesajlar
- 618
- Excel Vers. ve Dili
- 2010 Türkçe
- Altın Üyelik Bitiş Tarihi
- 07-01-2024
Aşağıdaki kodda userformun içine dinamik olarak oluşturulan labellere click olayını ekleyemedim. Yardımcı olabilir misiniz ?
Kod:
Private WithEvents lbl As MSForms.Label
Private Sub UserForm_Initialize()
Dim col As Integer
Dim lbl As MSForms.Label
Dim lbl2 As Object
For col = 1 To 4
' Dış label
Set lbl = Me.Controls.Add("Forms.Label.1", "lblCol" & col)
With lbl
.Left = 20
.Top = 10 + (col - 1) * 40
.BackColor = RGB(255, 255, 255)
.Width = 500
.Height = 30
End With
' İç label
Set lbl2 = Me.Controls.Add("Forms.Label.1", "lbl2Col" & col)
With lbl2
.Caption = "İç Etiket " & col
.Left = lbl.Left + 20
.Top = lbl.Top + 10
.Height = 10
.Font.Name = "Nunito"
.Font.Size = 10
.BackStyle = 0
End With
Next col
End Sub
Private Sub lbl2_Click()
With lbl
.BackColor = RGB(255, 255, 0)
End With
End Sub