[英]Excel VBA Userform Controls
Good morning all, 大家早上好,
I have a ComboBox and a MultiPage in an Excel Userform. 我在Excel Userform中有一个ComboBox和一个MultiPage。 What I would like to create is a Sub that basically sets the Visibility to 0 for all MultiPage pages where the name does not equal the ComboBox selection, but I'm getting stuck.
我想要创建的是一个Sub,它基本上将所有MultiPage页面的Visibility设置为0,其中名称不等于ComboBox选项,但我卡住了。
Sub changeMultiPageVisibility()
If userForm.templateComboBox = "Criteria1" Then While
multiPage.Names <> userForm.templateComboBox Set multiPage.Pages.Visible = 0
I'm still new to working with VBA and UserForms, if anyone can point me in the right direction I'd greatly appreciate it. 我还是刚开始使用VBA和UserForms,如果有人能指出我正确的方向,我会非常感激。 Thanks!
谢谢!
I would use this code for ComboBox change event : 我会将此代码用于ComboBox更改事件 :
Private Sub templateComboBox_Change()
Dim p As MSForms.Page
For Each p In MultiPage.Pages
p.Visible = (p.Name = templateComboBox.Value)
Next
End Sub
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.