MultiPage Control problem

P

Patrick Simonds

I have a UserForm on which I have placed a MultiPage control. The MultiPage1
control has 4 pages (Data, Income, Outstanding and Instructions). I use a
variant of the code below to bring up the UserForm with the proper page on
the MultiPage control displayed, and it works fine.

Now my problem is that on the Income page I have placed another MultiPage
control (MultiPage2 control) with 6 pages (one for each month January -
June) and I can not figure out how to alter the code below to bring up one
of the monthly pages on the MultiPage2 control. When I run the code I get an
Invalid procedure call or argument error and the line "Data_Input.Show" is
highlighted.



Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)

If Not Application.Intersect _
(Target, Me.Range("B3:I3,K3")) Is Nothing Then
myMPPageName = "January"
Data_Input.Show

End If

End Sub
 
T

Tom Ogilvy

Sub ShowForm()
Load Data_Input
Data_Input.MultiPage1.Value = 1
Data_Input.MultiPage1.Pages(1).MultiPage2.Value = 0
Data_Input.Show
End Sub

worked fine for me.

The second page of the Multipage1 was shown (Income) and on it, the first
page of the Multipage2 control was shown (January)

you can refer to a page with its name as shown here (from the immediate
window):
? data_Input.Multipage1.Pages("Income").Multipage2.Pages("January").Caption
January

But you can't do something like this:
Data_Input.MultiPage1.Value = "Income"
Data_Input.MultiPage1.Pages("Income").MultiPage2.Value = "January"
Data_Input.Show
 
P

Patrick Simonds

Thank you sir, but I still get the Invalid procedure call or argument error
and the "Load Data_Input" is highlighted. I did change your original code to
change Data_Input.MultiPage1.Value = 1 to a Value of 2 to point at the 3rd
page (Income).


If Not Application.Intersect _
(Target, Me.Range("B3:I3,K3,C12")) Is Nothing Then

Load Data_Input
Data_Input.MultiPage1.Value = 2
Data_Input.MultiPage1.Pages(2).MultiPage2.Value = 0
Data_Input.Show

End If
 
P

Patrick Simonds

Sorry the problem is not with what you helped me with but in my Userform
initialization. So I will check that out. Again thanks for your help.
 
P

Patrick Simonds

My problem seems to resolve around the code at the beginning of my UserForm
Intialization routine. Some how I assume I must also account for the
MultiPage2.



With Me.MultiPage1
.Value = .Pages(myMPPageName).Index
End With
 

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