VBA Userform: Using a command button to navigate to another page in MultiPage

multipageuserformvba

Using a command button to navigate to another page in MultiPage rather than clicking on the actual page at the top of the form

Best Answer

You have to use the Value property of your MultiPage object.

Code example:

NameOfYourForm.NameOfYourMultiPageObject.Value = 1

Be careful: First page is not value 1 but value 0

'Select first page
NameOfYourForm.NameOfYourMultiPageObject.Value = 0
'Select second page
NameOfYourForm.NameOfYourMultiPageObject.Value = 1
'Select third page
NameOfYourForm.NameOfYourMultiPageObject.Value = 2

Example with result

Here is an example with a simple UserForm and 4 buttons.

Informations:

Name of the form: MultiPageUserForm

Name of the multipage object: MultiPageExample

Private Sub SelectPage1_Click()
    MultiPageUserForm.MultiPageExample.Value = 0
End Sub

Private Sub SelectPage2_Click()
    MultiPageUserForm.MultiPageExample.Value = 1
End Sub

Private Sub SelectPage3_Click()
    MultiPageUserForm.MultiPageExample.Value = 2
End Sub

Private Sub SelectPage4_Click()
    MultiPageUserForm.MultiPageExample.Value = 3
End Sub

VBA Multipage Selection Through Button

Related Topic