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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

drop down menu in form 1

Status
Not open for further replies.

vttech

Technical User
Jan 28, 2006
297
US
How do you create a drop down menu in a VBA form

example a menu with the following options

Black
Red
Green

Just to be clear this is for a form not the usual way
Goto menu Data>Validation, set Allow to List, and enter the values as comma
delimited list
 
One way:
Private Sub UserForm_Initialize()
ComboBox1.AddItem "Black"
ComboBox1.AddItem "Red"
ComboBox1.AddItem "Green"
End Sub

Another way is to set the RowSource property to an excel range containing the values list.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 


Hi,
How do you create a drop down menu in a VBA form
...
Just to be clear this is for a form not the usual way
Goto menu Data>Validation
These are two contradictory statements.

It sounds to me like Data/Validation and not a VBA UserForm.

You can create a list quite simply on the same sheet in 3 cells, lets say in AA1:AA3
[tt]
Black
Red
Green
[tt]
Then in Data/Validation - List enter in the textbox...
[tt]
=AA1:AA3
[/tt]

Skip,

[glasses] [red]Be Advised![/red] For those this winter, caught in Arctic-like calamity, be consoled...
Many are cold, but few are frozen![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top