user9184557
user9184557

Reputation: 92

How to select/open a page available under a Multipage (Userform) using VBA code

I am trying to prompt a message to a user to select at least one checkbox available under each Page's (Multipage option) on a Userform and navigate him to that page to select the checkbox

Code

'this will check whether any checkbox selected, if not it will prompt to select any one
If UF1_Revenue_Location_Role_Srch.Revenue_Loc_CheckBox1.Value = True And Not _
    (UF2_Revenue_DailyRate.MultiPage1.Page1.Revenue_Ind_CheckBox1.Value = True _
    Or UF2_Revenue_DailyRate.MultiPage1.Page1.Revenue_Ind_CheckBox2.Value = True _
    Or UF2_Revenue_DailyRate.MultiPage1.Page1.Revenue_Ind_CheckBox3.Value = True _
    Or UF2_Revenue_DailyRate.MultiPage1.Page1.Revenue_Ind_CheckBox4.Value = True _
    Or UF2_Revenue_DailyRate.MultiPage1.Page1.Revenue_Ind_CheckBox5.Value = True) Then
MsgBox "To Proceed: Kindly select atleast one Designation under Location India"
UF2_Revenue_DailyRate.MultiPage1.Page1.Show
    Call UserForm_Initialize

Else

 If UF1_Revenue_Location_Role_Srch.Revenue_Loc_CheckBox2.Value = True And Not _
    (UF2_Revenue_DailyRate.MultiPage1.Page2.Revenue_Ger_CheckBox1.Value = True _
    Or UF2_Revenue_DailyRate.MultiPage1.Page2.Revenue_Ger_CheckBox2.Value = True _
    Or UF2_Revenue_DailyRate.MultiPage1.Page2.Revenue_Ger_CheckBox3.Value = True _
    Or UF2_Revenue_DailyRate.MultiPage1.Page2.Revenue_Ger_CheckBox4.Value = True _
    Or UF2_Revenue_DailyRate.MultiPage1.Page2.Revenue_Ger_CheckBox5.Value = True) Then
MsgBox "To Proceed: Kindly select atleast one Designation under Location Germany"
UF2_Revenue_DailyRate.MultiPage1.Page2.Select
    Call UserForm_Initialize

On above code, I try to open the page using select option and Show option

UF2_Revenue_DailyRate.MultiPage1.Page1.Show
UF2_Revenue_DailyRate.MultiPage1.Page2.Select

but none of them really works.

Is there any other way to open this page to the user so that they can easily select the checkbox from it instead of selecting the page one by one?

Thanks in advance....

Upvotes: 2

Views: 6444

Answers (1)

sporc
sporc

Reputation: 387

You can set the Attribute Value of your Multipage:

UF2_Revenue_DailyRate.MultiPage1.Value = 0 'Page1
UF2_Revenue_DailyRate.MultiPage1.Value = 1 'Page2

Remember that it starts with 0

Upvotes: 3

Related Questions