Pages on multipage UserForm appear blank when enabled or made visible

Better2BurnOut

New Member
Joined
Jul 4, 2017
Messages
2
Hi,

I've created a multipage UserForm with 10 pages and am in the process of adding "Back" and "Next" buttons to the form. I've searched through the forums and tried both methods of 1) Enabling and 2) Visibility of the pages to achieve what I want. Unfortunately, with both methods, when I click on the "Next" button, the page is blank and I cannot see any of the controls on the page (text boxes, combo boxes, etc.); I can only see the tab title. I have to click once more on the tab title before the controls are loaded and visible. This problem only occurs when I am cycling forward through the tabs clicking on the "Next" buttons, it doesn't happen when I click on a "Back" button. Irrespective of whether I use .Visible or .Enabled, I still get the same overall issue.

Example (with only three pages):
Code:
Private Sub UserForm_Initialize()
    Me.MultiPage1.Pages("Page1").Visible = True
    Me.MultiPage1.Pages("Page2").Visible = False
    Me.MultiPage1.Pages("Page3").Visible = False         
End Sub

Private Sub CBtnNext1_Click()
    Me.MultiPage1.Pages("Page1").Visible = False
    Me.MultiPage1.Pages("Page2").Visible = True
    Me.MultiPage1.Pages("Page3").Visible = False
End Sub

Private Sub CBtnBack1_Click()
    Me.MultiPage1.Pages("Page1").Visible = True
    Me.MultiPage1.Pages("Page2").Visible = False
    Me.MultiPage1.Pages("Page3").Visible = False
End Sub
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
[SOLVED] In the time it took to moderate my thread/query and post it to the forum, I had a break through and realised the error in my coding. N.B. - I had been banging my head against a brick wall for quite some time before posting. :confused:

The issue lies in the order of my lines of code. If I have no pages visible at any time, I get the error, i.e. if I make the current, visible page not visible before making the second page visible, the error occurs. I need to make the second page visible first and then make the first page not visible. The issue never arises when coding for the Back buttons because of the number order of my pages.

Incorrect Order:
Code:
Private Sub CBtnNext1_Click()
    Me.MultiPage1.Pages("Page1").Visible = False
    Me.MultiPage1.Pages("Page2").Visible = True
    Me.MultiPage1.Pages("Page3").Visible = False
End Sub

Correct Order:
Code:
Private Sub CBtnNext1_Click()
    Me.MultiPage1.Pages("Page2").Visible = True
    Me.MultiPage1.Pages("Page1").Visible = False
    Me.MultiPage1.Pages("Page3").Visible = False
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,365
Messages
6,124,513
Members
449,168
Latest member
CheerfulWalker

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