Macro should work in only the file it is written in

Brass Contributor

Hi Folks,

I have some macro excel files and i have assigned them shortcuts, But when normal files are opened then those macros work on those files instead of default excel shortcuts. for example Ctrl+Shift+L is shortcut for filter but in my macro enabled file i have assigned some macro but while that macro file is opened in my PC then in all the excel files Ctrl+Shift+L works as that macro, But i want that to work in only that workbook not others, Is there a way to do the same?

Thanks

4 Replies

Hi @yugal40 

 

since all worksheets are usually opened within one single instance of Excel, the defined shortcuts are valid for all open worksheets.

 

You can probably avoid this if you open your macro file in a separate Excel instance. To do so, press the Alt-Key and hold it when you launch Excel, until you get a window like this:

DTE_0-1641398447459.png

Now you can release the Alt-Key and click on Yes to start a new instance.

 

And open all the other files in another Excel instance, not in the same one where the macro file is opened. This way I imagine the shortcuts should work as expected.

 

Thankyou for your reply, Honestly looking for some thing which can normally be used, like many people use those file so every one is not capable of remembering alt key while opening an excel instance.
I'm very new to macro, I saved my macro as custom templet and instead of using short cut key I select from the list and run desired macro on the sheet I'm working in, not sure if this will help you or not.
It won't help me as i want to use it as shortcut key
Thanks for the reply