VBA Navigation on Multipage Userform with Hidden Page

DixiePiper

New Member
Joined
Oct 19, 2015
Messages
41
Office Version
  1. 365
Platform
  1. Windows
I've searched around and either I'm asking the question wrong or there actually isn't an available solution.

On page 2 of a 5 page Multipage userform, I have an option button that, when selected, causes the next page of the multipage to be hidden. Everything is working swimmingly with the exception of the navigation. Outside the Multipage, on the userform, I have "cancel", "back", "next", and "finish" buttons to control movement through the form. With page 3 hidden, I cannot seem to navigate back from page 4 to page 2. Everything with my navigation was working until I needed to modify the form to hide a page.

The script I'm using for the "Back" button is:
Code:
Private Sub cmdBack_Click()
    mpData.value = mpData.value - 1
    
    Select Case mpData.value
        Case 0
            txtTORFQ.SetFocus
        Case 1
            optBaseNo.SetFocus
        Case 2
            txtBaseOn1.SetFocus
        Case 3
            cmdGSelectAll.SetFocus
            
    End Select
    
    UpdateControls

End Sub

The extra piece is the "Update Controls" script which works just fine
Code:
Sub UpdateControls()
    Select Case mpData.value
        Case 0
            cmdBack.Enabled = False
            cmdNext.Enabled = True
            cmdFinish.Enabled = False
        Case 1
            cmdBack.Enabled = True
            cmdNext.Enabled = True
            cmdFinish.Enabled = False
        Case 2
            cmdBack.Enabled = True
            cmdNext.Enabled = True
            cmdFinish.Enabled = False
        Case 3
            cmdBack.Enabled = True
            cmdNext.Enabled = True
            cmdFinish.Enabled = False
        Case 4
            cmdBack.Enabled = True
            cmdNext.Enabled = False
            cmdFinish.Enabled = True
    End Select
    
    Me.Caption = AppName & " Step " _
        & mpData.value + 1 & " of " _
        & mpData.Pages.Count
End Sub

As a note, I'm working in Microsoft 365, so whatever version of Excel that is. I have no real programming background and have learned what I know from the Great Google and the help of message boards, etc. Thanks in advance for any help.
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.

Forum statistics

Threads
1,214,978
Messages
6,122,549
Members
449,089
Latest member
davidcom

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top