Dropdown VBA Code

Smytgemm

New Member
Joined
Jul 22, 2009
Messages
2
I would like to insert a combo box or dropdown into excel 2007 using VBA code in which I can select the options (i.e. not refering to cell already selected).
I already know how to do this the excel tool bar but I would prefer to do it straight from VBA.
Any suggestions would be much appreciated.
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
I would like to insert a combo box or dropdown into excel 2007 using VBA code in which I can select the options (i.e. not refering to cell already selected).
I already know how to do this the excel tool bar but I would prefer to do it straight from VBA.
Any suggestions would be much appreciated.


Use with and .AddItem

i.e. for a combobox called Cboitems with the choices Item 1, Item 2, Item 3 your code would look like this:

with Cboitems
.AddItem "Item 1"
.AddItem "Item 2"
.AddItem "Item 3"
End With
 
Upvote 0
Thanks, I know what you mean but how do I actually make the original combobox?
I can't seem to find that code anywhere?
 
Upvote 0

Forum statistics

Threads
1,215,740
Messages
6,126,582
Members
449,319
Latest member
iaincmac

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