I have, for example, a drop-down list (Combo Box, not a cell with data verification).

There is the following code:

Sub DropDown_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) If ActiveSheet.ComboBox1.TopIndex > -1 Then Dim curIndex As Integer curIndex = ComboBox1.TopIndex + Application.WorksheetFunction.RoundDown(Y / 13.5, 0) curValue = ComboBox1.List(curIndex) Range("G1").Value = curValue End If End Sub 

How can I correctly attach this function to an element? Tried via 'Assign Macro', but Excel seems to think that only click events are assigned through this button. Or do I need to replace DropDown with the element name? If so, how can I get the name of the item?

    1 answer 1

    When you add a control there are two groups - "Form Controls" and "ActiveX Controls". Use ActiveX, they have events available.

    • Clearly, unfortunately ActiveX controls are only available on Windows. - user64675
    • Working at MAC? Would you write why the Check_data is not accepted, UserForm? What caused the restrictions? - vikttur