• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Assigning keyboard shortcuts to macros

aohara3141

New Member
I was wondering if you assigned a keyboard shortcut to a macro on a PC, would this be carried across to someone using the same file on a Mac? I’ve assigned a macro to Ctrl+e on my PC and was told it will be mapped to Option+Cmd+e on the Mac. I don’t have a Mac I can test this on but would like to know if this is true or if the Mac user will need to reassign the shortcut key themself.
 
If I understand your question correctly, this really has to do with the way applications in general work, rather than with VBA specifically. When you're using a PC you can assign a VBA program to <Ctrl-e>— in Excel, say — and Excel will record it. If you were doing the same thing on a Mac, you'd have to use Option+Command+e instead, and Excel would record that.

But the Excel you'd run on your PC and the Excel you'd run on a Mac are two different programs and they don't communicate with each other when you make the assignment to either one. You'd have to create the macro separately on each machine and do the assignment separately too.

Could you make them communicate? I'm not a Mac user, but I'd think that if you have a Mac and a PC on the same network, you could write a program that would take the VBA code you'd created, store in on the PC and assign it to <Ctrl-e>, then open communications with Excel on the Mac, store the macro there and assign it to Option+Command+e. Sounds like a lot of work, though.
 
Thanks for your reply Bob. Considering just Excel (not other apps) it was my understanding that the macro code and the keyboard shortcut assigned to it, live with the file - not at the application level, and certainly not at the hardware level otherwise you would have to re-assign the keyboard shortcut every time.

My question was around the mapping of the shortcut on a Mac and whether Excel, recognising that the macro has been assigned Ctrl+e on a PC, maps it to the nearest equivalent (in this case Option+Cmd+e) on the Mac. I don't have a Mac either. I was under the impression that Ctrl+e was either used for something else on the Mac or that there may not be a Control key on the Mac keyboard, but I could easily be wrong on both counts.
 
Saved with the workbook, really? That hadn't occurred to me, and if you're right of course it makes a difference.
 
That is correct.

Both Ctrl+e and Cmd-Option-e work on my mac for a ctrl+e shortcut.
Thank you Debaser. So are you saying that if a keyboard shortcut is assigned to a macro on a PC, then this will be mapped to an equivalent shortcut on a Mac? In this instance, Ctrl+e WILL get mapped to Cmd+Option+e on the Mac?
 
Back
Top