VBA Excel: 列表框出现在所有多页上

VBA Excel: Listbox Appears on All MultiPages

我有一个带有多页框的用户表单。此多页上有几个选项卡。我在第一页上插入了一个列表框,但无论选择哪个选项卡,它似乎都会出现。我只希望它出现在第一页上。有没有属性来改变这个?

这是我打开新的多页用户窗体 (TabData) 的代码:

Unload MainSelectionForm
TabData.Show

As you can see, on the first page there is a ListBox (black border)

Clicking on the second tab, there is still a listbox

您应该处理 MultiPage(处理选项卡的对象)的更改事件,以下逻辑代码应该可以工作,适合您的需要 (this is in the UserForm code)。

Private Sub MultiPage1_Change()
If MultiPage1.Value = 0 Then
ListBox1.Visible = True
Else
ListBox1.Visible = False
End If
End Sub