4
votes

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!

1

1 Answers

4
votes

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