Select UserForm from drop down list …

adambc

Active Member
Joined
Jan 13, 2020
Messages
370
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
I have a Workbook that opens a UserForm when the file is opened (and does lots of stuff with the data entered) …

I now need to add a number of other UserForms and allow the User to select which one is opened when the file is opened …

I’m thinking about a UserForm with a List, but not quite sure how I use whatever the User selects to pass to the logic that opens the correct UserForm eg …

Can I pass the value to a [variable] within a Sub (without needing to save it anywhere)?

If [variable] = X Then
frmX.show
etc
etc

Can anyone help?

Thanks …
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
You may need to work on the syntax a bit but you would use something along the lines of:

Select Case frmX.{name of dropdown field}.Value
Case "red"
'call form 1'
FormRed
Case "Blue"
'call form 2
FormBlue
Case Else
End Select
 
Upvote 0
UPDATE …

I figured this out all by myself!!!

UserForm1 with a ComboBox and a CommandButton …
- loads when Workbook opens
- Initialize populates cbo list
- cmd code sets a variable on the value selected from the cob list
- populates Cell in Workbook used to stor selected value
- Unloads frm
- uses variable in a series of If/Else If/Else/End If statements to load appropriate UserForm

Works perfectly …
 
Upvote 0
Solution

Forum statistics

Threads
1,214,875
Messages
6,122,037
Members
449,062
Latest member
mike575

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