Where did my code go?

ransomedbyfire

Board Regular
Joined
Mar 9, 2011
Messages
121
I wrote a few macros in a spreadsheet a few days ago and then set it, via the project properties window, to be an add-in. I also made a shortcut key for the macro.

Now, I cannot, for anything, find the Onkey code that sets the shortcut key for that macro. But the shortcut key still works. So, it has to be somewhere, right?

Can anyone help me?
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
One likely place to look would be in the Workbook_Open event procedure located in the ThisWorkbook module.
 
Upvote 0
If you set up the shortcut key via the interface (the macros dialog box) then it isn't "in your code" anywhere. It's part of the workbook's built-in property set. You'd have to edit it again using the same macro dialog box. If you have XL 2007 or 2010, then the file is XML, and you could conceivably access it. But I wouldn't know how. AFAIK, it'd take someone like Andy Pope or Ron de Bruin to unspool the XML and tell you how to find it by a means other than the dialog box.
 
Last edited:
Upvote 0
One likely place to look would be in the Workbook_Open event procedure located in the ThisWorkbook module.
Thanks for the suggestion. I have looked, and it is empty.

If you set up the shortcut key via the interface (the macros dialog box) then it isn't "in your code" anywhere.
Nope, I made it using the application.onkey code - I think. But thanks for the suggestion! (In case I'm remembering wrong, is there a way to know whether the key was assigned via user interface instead of code?)
 
Upvote 0
Nope, I made it using the application.onkey code - I think. But thanks for the suggestion! (In case I'm remembering wrong, is there a way to know whether the key was assigned via user interface instead of code?)

I'd have go through the list of macros in the dialog box and list them out. If there's a better way, I don't know it.

If you really are setting it using OnKey, then you should be able to just hit Ctrl+F in the VBE and set the search scope to Entire Project and search the entire project.
 
Upvote 0

Forum statistics

Threads
1,224,595
Messages
6,179,798
Members
452,943
Latest member
Newbie4296

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