views:

223

answers:

1

Is this possible in Excel?

I have a workbook with multiple worksheets. I wrote some vba code in a code module to shell to an exe and pass it cell values as arguments.

What I want to be able to do is select a cell or row in any of my worksheets and then call my Shell Sub while passing the values from a couple cells to the Sub. A hot-key combination would be best.

The part I am having trouble with is calling a sub in a code module from a hot hey.

Can you help with this? Any sample code?

Much appreciated!

+1  A: 

Found my answer! It was in a post from Leith Ross found here...

http://www.excelforum.com/excel-programming/590157-keyboard-shortcut-to-run-sub-module-in-vb.html

If your macro is a Sub then its easy to assign a shortcut key to your macro. While in Excel, type ALT+F8 to bring up the Macros List. Select the name of your macro by clicking it. At the bottom right corner of the dialog, click "Options..". You can then assign a shortcut key and add a description of the macro for other to see when it is selected in the Macro List.

That's exactly what I needed.

Doug
Nice trick. Mark your own answer as correct (you can do it).
jpinto3912