How to refer to a combo box in VBA

pbaxter

New Member
Joined
Aug 31, 2010
Messages
13
I would like to form a combobox name in code in order to manipulate it:

This won't work:
Sheet1.Comboboxes("combo" & 12).Clear because there's no ComboBoxes collection in Sheet1.

I haven't had any luck using the Shapes or OLEObjects collections.

Any ideas?

TIA,

Paul
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
What are you trying to do with Clear? Are you trying to remove the ListFillRange? Or has it been filled some other way?

Sheet1.OLEObjects("ComboBox" & 1).ListFillRange = ""
 
Upvote 0
Thanks, Glenn.
The OLEObjects method does work, but not for all methods of a combobox. Combobox.Clear is one example.

So I was looking for something like Sheet1.Comboboxes("combo" & 12).

Paul

BTW I'm stealing "Beauty is in the eye of the beer-holder. ":rofl:
 
Upvote 0

Forum statistics

Threads
1,224,616
Messages
6,179,912
Members
452,949
Latest member
beartooth91

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