Multipage Buttons?

  • Thread starter TotallyConfused
  • Start date
T

TotallyConfused

I apologize for my ignorance. I had posted before and I am able to change
the color of the buttons on a Multipage in an Excel Userform. My multiplage
is currently at 5 pages. However, I still cannot figure out how to make
changing the colors of the buttons when I select another button to open
another page. When I press the button it turns color but does not open the
page. When I click on another button I need the previous button to go back
to original color. I don't think I am doing this with the following code.
Can you please help.? Thank you

Private Sub MultiPage1_Change()
Dim cb1 As CommandButton
Set cb1 = Me.CommandButton52
If Me.MultiPage1.Pages(14).Caption = Visible = True Then
Me.MultiPage1.Pages(14).Caption = ""
Me.MultiPage1.Pages(0).Caption = Visible = False
Me.MultiPage1.Value = 1
cb1.BackColor = &HFFFF80
End If
Set cb1 = Me.CommandButton53
If Me.MultiPage1.Pages(15).Caption = Visible = True Then
Me.MultiPage1.Pages(15).Caption = ""
Me.MultiPage1.Pages(0).Caption = Visible = False
Me.MultiPage1.Value = 1
cb1.BackColor = &HFFFF80
End If
End Sub
 
P

Patrick Molloy

I'm not sure what this means...

If Me.MultiPage1.Pages(14).Caption = Visible = True Then

as written it is the same as

If Me.MultiPage1.Pages(14).Caption = (Visible = True) Then

I suggest

If Me.MultiPage1.Value = 14 Then

Value returns the index of the active page


so you code could be re-written

Select case MultiPage.Value
Case 14
Set cb1 = Me.CommandButton52
Case 15
Set cb1 = Me.CommandButton53
Case Else
Set cb1 = Nothing
End Select
If not cb1 is nothing then
cb1.BackColor = &HFFFF80
Me.MultiPage1.Value = 1
End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top