Reputation: 474
Good morning all,
I have a ComboBox and a MultiPage in an Excel Userform. 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 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. Thanks!
Upvotes: 4
Views: 1217
Reputation: 35853
I would use this code for ComboBox change event:
Private Sub templateComboBox_Change()
Dim p As MSForms.Page
For Each p In MultiPage.Pages
p.Visible = (p.Name = templateComboBox.Value)
Next
End Sub
Upvotes: 4