SeletionChange Event on ENTER error

jensslofstra

New Member
Joined
Sep 13, 2016
Messages
9
Hi everyone,
I was tinkering with the selectionchange event but came across an error.
"Cannot run the macro ''.xlsm'!DropdownList'. The macro may not be available in the workbook or all macros may be disabled."

I checked in my options if the trust center blocked my macro but it's on "enable all macros".
I saved the file as .xlsm so I don't see any problems with the file extension.

The code is as follows. And is written in Sheet1

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Application.OnKey "~", "DropdownList"
End Sub


Sub DropdownList(Cancel As Boolean)
    Target.Value = 1
End Sub

Does anyone have any idea how I can fix this?

Thanks anyways!
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
The Dropdownlist routine needs to be in a normal module (that is not also called DropDownList) and should not take any arguments (you aren't using any anyway).
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,160
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