Dear Guys,
I need your helps. First of all, I created checkbox dynamic in orange code.
Public Sub UserForm_Initialize()
Application.Workbooks("17.03 gecesi").Worksheets("Sayfa1").Activate
Dim sutunsayisi As Integer
sutunsayisi = Range("A1", Range("A1").End(xlToRight)).Count
Range("A1").Select
Dim Cb As Variant
Dim x As Integer
Dim tp As Integer
tp = 20
For x = 1 To sutunsayisi
Set Cb = UserForm1.Controls.Add("Forms.CheckBox.1", "CheckBox" & "x", True)
MsgBox Cb
' Cb.Name = "cb" & x
Cb.Caption = Sayfa1.Cells(1, x).Value
Cb.Width = 100
Cb.Height = 20
If x Mod 2 = 0 Then
Cb.Top = tp + 10
tp = tp + 30
Cb.Left = 130
Else
Cb.Top = tp + 10
Cb.Left = 20
End If
'ActiveCell.Offset(0, 1).Select
Next x
Then I create a dynamic commanbutton which name is next in blue code.
'Dim Com As Control
Set Com = UserForm1.Controls.Add("Forms.CommandButton.1", "CommandButton")
Com.Caption = "İleri"
Com.Width = 72
Com.Height = 24
Com.Top = tp + 10
Com.Left = 135
End Sub
Now I want to create a new userform rely on the codes that I told above. When I click the checkbox 1 and command button, the second userform will be open. If I click the checkbox 1 and 2 and commandbutton then, first userform 2 will be open and then userform 3 will be open. I started below but It is not working.
Private Sub Com_Click()
If UserForm1.Controls.CheckBox1.Value = True Then
UserForm2.Show
Else
UserForm3.Show
End If
End Sub
This emergency, pleeeeaseeee help meeeee rapidly !!!!!!!!!!!!!!!!!
Bookmarks