VBA macro executes when I press ESC?!

andrew.ward

New Member
Joined
May 5, 2002
Messages
26
Hi All,

I have an excel workbook created in 2007, but now running in 2010. In the workbook I have a form Combo box with a macro assigned to it. When I click any value in the combo dropdown list the macro executes. In 2007 I could click the combo dropdown box and then press ESC to exit from the form control without executing the assigned macro. Similarly I could also click on any other cell to exit from the control without executing the macro.

But, in 2010 if I press ESC or click on any other cell the macro will execute. How do I stop this from happening please? Sometimes I want to be able to exit from the combo box without executing the macro.

thanks for your help,
Andrew
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Anyone got any suggestions as to the cause or suggestions on where to start with debugging the problem?

Thanks
Andrew
 
Upvote 0
MAybe you should post your code !
 
Upvote 0
Thanks, but it isn't related to the actual code. I tested this by opening a new workbook in Excel 2010, adding a form combobox to worksheet 1 with a few dummy values to create a dropdown list and then assigned the following macro to it:

Code:
Sub Test_Code()
    
    ActiveCell.Value = Date 
    
End Sub

When I expand the dropdown list, then press ESC (or click on an empty cell) to exit from the combobox the macro still triggers. If I save and close this workbook then reopen in Excel 2007, then expand the dropdown list, when I press the ESC button (or click on an empty cell) I can exit out of the combobox without triggering the macro. Being able to exit out of the combobox without triggering the macro is obviously the desired behaviour.

Anyone got any thoughts why this is happening?

Thanks for the help
Andrew
 
Upvote 0

Forum statistics

Threads
1,213,551
Messages
6,114,273
Members
448,559
Latest member
MrPJ_Harper

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