Fire change event for ActiveX combobox

kinn91

New Member
Joined
Jul 31, 2019
Messages
6
Hi all,
I have an issue with an ActiveX combobox.

In my workbook, an activeX combobox is created each time a cell is clicked. I would like to trigger an event so that when the value of the combobox change, it triggers an event that modify the adjacent one.

My problem is that, as you know, the ActiveX combobox change doesn't trigger Worksheet_change sub.

That's my code:

Code:
Dim cb as Combobox

Set cb = ActiveSheet.OLEObjects.Add(ClassType:="Forms.Combobox.1", Link:= False, DisplayAsIcon:=False, Left:=currentTarget.Left, Top:=currentTarget.Top, Width:=currentTarget.Width, Height:=currentTarget.Height).Object

cb.LinkedCell = currentTarget.Address

For Each cell in rng1
    cb.AddItem cell.value
Next cell

For Each cell in rng2
    cb.AddItem cell.value
Next cell

I tried to catch the change event using:

Code:
Private Sub Combobox1_Change()
   MsgBox "ok"
End Sub

That is never fired.
Suggestions?

P.S.: as you can see no name is specified for comboboxes, all those share the same creation code.
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

Forum statistics

Threads
1,224,823
Messages
6,181,180
Members
453,021
Latest member
Justyna P

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