Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to select from three choices with something like an InputBox?

Status
Not open for further replies.

navyguy

Programmer
Aug 10, 2002
30
US
I would like to add some code prompt the user (in a window similar to an inputbox) to select either "round", "circle", or "square". When the user presses "OK", the choice is assigned to the variable profile_type.

Currently I have following code attached to a command button in Excel:

Private Sub CommandButton_save_profile_Click()
saved_name = InputBox("Please enter name")
profile_type = ??????

Sheet1.Range("A1") = saved_name
Sheet1.Range("B1") = profile_type

End Sub



Any ideas?
 
To make an "OPTION"-al input and have the User click on OK as you stated:

Create a UserForm with the options you wanted and have the above command button show the form after the button is pressed.


As for saving the data, you have 2 options here:

1) show the new UserForm in modal style--this way the user MUST select one of the options before the rest of the code is processed (including the "save" selection you show above).

or 2) Have the above CmdBtn save only the InputBox data and have the UserForm save the Profile data only, before unloading itself.


HTH,
--MiggyD
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top