Is there a way to run a userform initialize with multipage that pertains to each page separately?
I have a MultiPage Userform with Checkboxes, ComboBoxes, and TextBoxes on each sheet with different control sources for each. Instead of programming each checkbox, I have been using a userform initialize to add the checkboxes, however this does not appear to work with multipage.
I have attempted to use an if statement to specify which page to initialize, but this does not seem to work. Any suggestions?
Thanks.
Private Sub UserForm_Initialize()
Dim Left As Single, Top As Single
Dim cell As Range, row As Range, check As MSForms.CheckBox
Top = 54
Left = 29
'Element Deficiency Matrix (1a to 3k)
If MultiPage1.Value = 0 Then
With Worksheets("Pier Data2")
For Each row In .Range("A122:K124").Rows
For Each cell In row.Cells
Set check = Me.Controls.Add("Forms.Checkbox.1")
With check
.ControlSource = "'" & cell.Parent.Name & "'!" & cell.Address(RowAbsolute:=False, ColumnAbsolute:=False)
.Left = Left
.Top = Top
.Width = 12.6
.Height = 17.6
Left = Left + 12
End With
Next
Left = 29
Top = Top + 17.6
Width = Width
Next
End With
End If
End Sub