LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 55
Default Call Macro on KeyPress

Bernie,

It works for me - Win XP and XL 2003. When I hold down the shift and then
press the =/+ key, it runs my macro. I'm trying to think if there is some
Excel setting that would produce the behavior you describe, but I can't
think of anything.

Doug


"bw" wrote in message
...
I have this working now, but alas, not the way I expected.

When I use <Shift+ as my key, I also have to use the <enter key.
What I was envisioning, was to just enter <Shift+ (or better yet, the +
on the keypad).
So, this is not possible?

Thanks again,
Bernie

"Jay" wrote in message
...
Hi bw -

"To assign a procedure to one of the special characters (+, ^, %, and so
on), enclose the character in braces." - excerpt from the builtin Visual
Basic Help system.

Using the "+" key to call a procedure is gutsy because it's such a
popular
key in and of itself... However, the following code will assign your
procedure to the "+" key in the alphanumeric section of your keyboard;
the
"+" key in the numberpad section will function as normal.
-------------------------------------------------------
To have the "+" key fire your procedure in all worksheets, copy the
following code to the ThisWorkbook module. Turning off the assignment
in
the Deactivate event will ensure that the "+" key is reset to its normal
function in other workbooks.

"To assign a procedure to one of the special characters (+, ^, %, and so
on), enclose the character in braces." - from the builtin Visual Basic
Help
system

Private Sub Workbook_Open()
Application.OnKey "{+}", "yourProcedureHere"
End Sub

Private Sub Workbook_Deactivate()
Application.OnKey "{+}"
End Sub
-------------------------------------------------------

To have the "+" key fire your procedure in one worksheet, copy the
following
code to the worksheet's module:

Private Sub Worksheet_Activate()
Application.OnKey "{+}", "yourProcedureHere"
End Sub

Private Sub Worksheet_Deactivate()
Application.OnKey "{+}"
End Sub

--
Jay


"bw" wrote:

If I press the "+" key, I want to call a macro.
I've looked at the OnKey Method, but it doesn't seem to handle my
situation.
How is this done?








 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can run a macro ( call a macro) on selection of any filtercriteria? [email protected] Excel Worksheet Functions 7 February 20th 09 12:34 AM
Call an Access macro from an Excel macro Jason W Excel Discussion (Misc queries) 1 May 1st 08 08:33 PM
Excel Macro call Word Macro with Parameters Bill Sturdevant[_2_] Excel Programming 9 May 24th 07 12:21 AM
Call macro stored in Excel workbook from Outlook's macro Gvaram Excel Programming 0 October 4th 06 05:47 PM
Trigger macro with keypress event?? CarlosAntenna Excel Programming 4 September 1st 05 08:35 PM


All times are GMT +1. The time now is 03:54 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"