0
votes

I am writing a program that executes a macro after pressing a button.

The code depends on the selection of the drop down box, however I do not want to run any macros after changing the drop down box.

I get this message:

Cannot run the macro "Test.xlsm'!DropDown22_Change" The macro may not be available in this workbook or all macros may be disabled.

How can I disable this attempt to run a macro after I change the selection?

1
@YowE3K How do I remove the Change event code? I'm not sure where to find it. I haven't written any code with change that I'm aware of. - R S
@YowE3K Test.xlsm sorry - corrected now. - R S
Can you right-click on the drop down, and select Assign Macro. If it shows something in the Macro name: field, delete it, then press OK. - YowE3K
If it doesn't have Assign Macro when you right-click on it, see if it has a View Code option. - YowE3K
I assume you haven't assigned the drop-down's Cell Link? If so, see stackoverflow.com/q/9578038/6535336 (e.g. ThisWorkbook.Sheets("Sheet1").Shapes("Drop Down 22").oleformat.object.list(ThisWorkbook.Sheets("Sheet1").Shapes("Drop Down 22").oleformat.object.listindex)). If you have assigned the cell link, just access the cell (e.g. ThisWorkbook.Sheets("Sheet1").Range("B2").Value if you linked to cell B2) which will give the index - if "Option 1" is the first item in the list, the linked cell will contain 1. - YowE3K

1 Answers

0
votes

Assuming your control is a Form Control, and not an ActiveX Control:

To disable the Change event for DropDown22, right-click on the drop-down control, select Assign Macro, and delete the contents of the Macro name: field. Then select OK.

Following these steps, the event should not fire when the user changes the selection within the drop-down.