Back button on a multipage userform

  • I've created a multipage userform to collect some data and am puzzled over the back button I have created and why it does not work as i would like. Basically as the user progresses through the form some of the pages on the userform are disabled according to their answers to previous questions. For example:


    If Var1.Value = True Then
    MultiPage1(13).Enabled = True
    MultiPage1(13).Enabled = False
    End if

    If Var1.Value = true then the userform has no trouble in skipping page 13 and going straight on to page 14 when I click the next button. However if I try and click the back button nothing happens. Here is my code for the back and next buttons:

    I understand that the userform will not skip back from Multipage 14 to Multipage 12 as the back button is saying Multipage1.Value = MultiPage1.Value - 1 (i.e. multipage 13), but why then does it skip from Multipage 12 to 14 when I click the next button? Is there a way I can get my back button to skip back to the last enabled page?

    thanks for your help.

  • Re: Back button on a multipage userform


    Just a thought but you could store the flag that your page is inactive / active in an array and then code your next / back buttons to activate the next non zero point in the array.


  • Re: Back button on a multipage userform


    On a userform add a multipage control and 2 buttons.
    2 of the five pages are disabled but then next and back buttons will progress you through.


  • Re: Back button on a multipage userform

    Thanks for that. I just copied the following code into my back button erasing the code I had in there before and it works fine now.

    As is often the case with these things, with hindsight it seems fairly obvious. But can anyone explain why Multipage1.value + 1 will forward the user to the next enabled whether or not the next page in the sequence is a disabled page but Multipage1.value - 1 will only take them back to the previous enabled page if the previous page in the sequence is not disabled? I don't need to know an answer, just curious.

    Many thanks again.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!