有没有办法运行userform初始化多页分别属于每个页面?
我有一个MultiPage Userform,每个工作表上都有Checkboxes,ComboBoxes和TextBoxes,每个工作表都有不同的控制源。我没有对每个复选框进行编程,而是使用userform初始化来添加复选框,但这似乎不适用于多页。
我试图使用if语句指定要初始化的页面,但这似乎不起作用。有什么建议吗?
感谢。
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