Issue of MultiPage.value setting as default in Userform_Initialize

NimishK

Well-known Member
Joined
Sep 4, 2015
Messages
684
Hi

I've small query regarding usage of Multipage
There is an issue when Userform is initilaized eventhough you set a Page value to a default

VBA Code:
Private Sub UserForm_Initialize()
Load uf1
MultiPage1.Value = 0
End Sub

Private Sub MultiPage1_Change()

Select Case MultiPage1.Value
Case Is = 0
combo1.Text =  "Rate % [+]"
combo1.AddItem "Rate % [+]"
combo1.AddItem "Rate % [-]"

Case Is = 1
combo2.Text =  "Rate % [+]"
combo2.AddItem "Rate % [+]"
combo2.AddItem "Rate % [-]"

End Select
End Sub

The above MultiPage1.Value = 0 will be default whether the userform in Coding Enviorment displaying Multipage value = 1

With above statement scenario
The issue was observed when combobox1 did not display its items the values when MultiPage1.Value = 0. from above multiPage1_Change event when form was intialized.
I had to click both the Tabs of Each Page to get its proper functioning

In anticipation of above issue then there could be more things croped up with clicking on Tabs of each page for proper functioning

Any other methods for proper result apart from all the combboxes1 and 2 with text property and .Additems incorporated in UserForm_Initialize Event

NimishK
 
Last edited:

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Hi,
There is no issue that I can see with UserForm_Initialize event - The MultiPage1_Change event will only trigger if a page is changed.
If the default page at design time is Page1 (value 0) then no change is being made when your form is first displayed - hence why no values are shown.

You should be able to resolve by making Page2 the "Active" page at design time & then your line of code in Initialize event setting value to 0 should trigger the event.

As a side note - you may want to review your AddItem codes in the Multipage change event as selecting pages will just keep adding the values to your comboboxes.

Hope Helpful

Dave
 
Upvote 0
Dave Indeed Helpful
vba said:
You should be able to resolve by making Page2 the "Active" page at design time & then your line of code in Initialize event setting value to 0 should trigger the event.

As a side note - you may want to review your AddItem codes in the Multipage change event as selecting pages will just keep adding the values to your comboboxes.

This is What i did under the circumstances
VBA Code:
Private Sub UserForm_Initialize()
If MultiPage1.Value = 0 Then
   MultiPage1.Value = 1
End If
 
If MultiPage1.Value = 1 Then
   MultiPage1.Value = 0
End If

End Sub

Select Case MultiPage1.Value
Case Is = 0
combo1.Clear
combo1.Text =  "Rate % [+]"
combo1.AddItem "Rate % [+]"
combo1.AddItem "Rate % [-]"

Case Is = 1
combo1.Clear
combo2.Text =  "Rate % [+]"
combo2.AddItem "Rate % [+]"
combo2.AddItem "Rate % [-]"

End Select
End Sub
Eventhough which ever page is active at design time. Line of code should execute from coding
NimishK
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,528
Messages
6,120,065
Members
448,942
Latest member
sharmarick

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