VBA: Setting the value of a combo box in code

dhancy

Board Regular
Joined
Jul 10, 2013
Messages
100
I have a form that includes a combo box. That combo box has a "change" event attached to it.

If the user selects a value from that combo box, the "change" event works as it should.

There is one case where I need to select a value for the combo box manually in the code.

I have tried:

VBA Code:
cboPasta.value = "Lasagna"

and

VBA Code:
cboPasta.listindex = 1

Both set the value in the combo box; however the "change" event isn't triggering.

Is there another approach I can use?

Thanks!


Dennis
 

Some videos you may like

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

dhancy

Board Regular
Joined
Jul 10, 2013
Messages
100
This is my "never mind" message.

I was wrong. The change event is triggering in this case. I was undoing the steps completed in the "change" code somewhere else.

Sorry about that. If I knew how to delete my original message on here, I would :)
 

Watch MrExcel Video

Forum statistics

Threads
1,118,767
Messages
5,574,126
Members
412,573
Latest member
Chriszion
Top