Next and back buttons in multipage userform

espenskeie

Well-known Member
Joined
Mar 30, 2009
Messages
636
Office Version
  1. 2016
Platform
  1. Windows
Hi

I have placed next and back buttons in the userform. I have a total of 8 pages.

The problem is that page 2 and 4 is not active. And I cannot see why. In the properties of the pages the data is exactly the same at all pages.

Are there errors in my code?

Code:
Private Sub cmdNext_Click()

    MultiPage1.Value = MultiPage1.Value + 1
    
End Sub

Private Sub cmdBack_Click()
    Dim intPage As Integer
    intPage = MultiPage1.Value
    Do
        intPage = intPage - 1
        If intPage = 0 Then Exit Do
    Loop While Not MultiPage1.Pages(intPage).Enabled
    MultiPage1.Value = intPage
End Sub
 
Private Sub MultiPage1_Change()
     
    If MultiPage1.Value = 0 Then
        cmdNext.Enabled = True
        cmdBack.Enabled = False
    ElseIf MultiPage1.Value = (MultiPage1.Pages.Count - 1) Then
        cmdNext.Enabled = False
        cmdBack.Enabled = True
    Else
        cmdNext.Enabled = True
        cmdBack.Enabled = True
    End If
     
End Sub

Regards
Espen
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Thanks, I found an error further down where someone had disabled page 1 and 3, in reality it was 2 and 4 that wasn't visible.

Now it is working fine ;)

Regards Espen
 
Upvote 0
Thanks, I found an error further down where someone had disabled page 1 and 3, in reality it was 2 and 4 that wasn't visible.

Now it is working fine ;)

Regards Espen

Hi, Just used this code so thanks for this Espen.

I would also like to mention that the multipages begin at '0' so multipage1 that you can see is, in excel terms, multipage0.

This is why 1 and 3 is to the outside looking in 2 and 4. It is the number you can see minus 1.

Just thought i'd put this on here for people in the future. It is still being viewed and used nearly 9 years later.

Thanks again
 
Upvote 0

Forum statistics

Threads
1,214,947
Messages
6,122,411
Members
449,081
Latest member
JAMES KECULAH

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