Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
How do you assign a macro to a shortcut key other than a combination
of ctrl that excel allows you to do from the toolsmacrooptions screen? For example, what if i want to use Alt + 1, or Shift + Ctrl + 1, or Alt + Shift + 1? Thanks! J |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() You can assign Shift+Ctrl+letter manually the same way as Ctrl+letter. It's simply the same but with the capital. You can also use Application.MacroOptions, see help. (can also export the bas module to text file, add the shortcut, and re-import). If you want to include Alt + letter w/out any combination of Shift+Ctrl you need to use the OnKey method, again see help for example. You will need to run the OnKey code each time your macro project loads. Regards, Peter T "cass calculator" wrote in message ... How do you assign a macro to a shortcut key other than a combination of ctrl that excel allows you to do from the toolsmacrooptions screen? For example, what if i want to use Alt + 1, or Shift + Ctrl + 1, or Alt + Shift + 1? Thanks! J |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() OnKey allows many more key combinations -- Gary''s Student - gsnu200819 "cass calculator" wrote: How do you assign a macro to a shortcut key other than a combination of ctrl that excel allows you to do from the toolsmacrooptions screen? For example, what if i want to use Alt + 1, or Shift + Ctrl + 1, or Alt + Shift + 1? Thanks! J |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Dec 9, 3:48*pm, Gary''s Student
wrote: OnKey allows many more key combinations -- Gary''s Student - gsnu200819 "cass calculator" wrote: How do you assign a macro to a shortcut key other than a combination of ctrl that excel allows you to do from the toolsmacrooptions screen? For example, what if i want to use Alt + 1, or Shift + Ctrl + 1, or Alt + Shift + 1? Thanks! J Could you please show me a simple example for how to use the OnKey method for combinations of ctrl, shift and alt? Thanks, Joshua |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Type onkey into the help diaolog when in the VBE
All combos are listed with usage instructions and examples Gord Dibben MS Excel MVP On Wed, 10 Dec 2008 07:50:57 -0800 (PST), cass calculator wrote: Could you please show me a simple example for how to use the OnKey method for combinations of ctrl, shift and alt? Thanks, Joshua |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Dec 10, 1:03*pm, Gord Dibben <gorddibbATshawDOTca wrote:
Type onkey into the help diaolog when in the VBE All combos are listed with usage instructions and examples Gord Dibben *MS Excel MVP On Wed, 10 Dec 2008 07:50:57 -0800 (PST), cass calculator wrote: Could you please show me a simple example for how to use the OnKey method for combinations of ctrl, shift and alt? Thanks, Joshua Sorry guys, I am a novice at this. Do I put the code application.onkey (key, procedure) into the respective subroutine that I am assigning it to, or can I put all my onkey code together (i.e. not as a line of a subroutine) Joshua |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Dec 10, 1:03*pm, Gord Dibben <gorddibbATshawDOTca wrote:
Type onkey into the help diaolog when in the VBE All combos are listed with usage instructions and examples Gord Dibben *MS Excel MVP On Wed, 10 Dec 2008 07:50:57 -0800 (PST), cass calculator wrote: Could you please show me a simple example for how to use the OnKey method for combinations of ctrl, shift and alt? Thanks, Joshua As an example, I have the following code that highlights all the precedents of a selection, and I'd like to assign it to the shortcut Ctrl + Shift + J Sub HighlightPrecedents() Dim rngCell As Range For Each rngCell In Selection rngCell.ShowPrecedents Next rngCell End Sub Where do I put the following code? Application.OnKey "^+{J}, "HighlightPrecedents" |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Dec 15, 10:47*am, cass calculator wrote:
On Dec 10, 1:03*pm, Gord Dibben <gorddibbATshawDOTca wrote: Type onkey into the help diaolog when in the VBE All combos are listed with usage instructions and examples Gord Dibben *MS Excel MVP On Wed, 10 Dec 2008 07:50:57 -0800 (PST), cass calculator wrote: Could you please show me a simple example for how to use the OnKey method for combinations of ctrl, shift and alt? Thanks, Joshua As an example, I have the following code that highlights all the precedents of a selection, and I'd like to assign it to the shortcut Ctrl + Shift + J Sub HighlightPrecedents() * *Dim rngCell As Range * *For Each rngCell In Selection * * * *rngCell.ShowPrecedents * *Next rngCell End Sub Where do I put the following code? Application.OnKey "^+{J}, "HighlightPrecedents" I tried it inside the procedure and got the following error - the macro 'highlightprecedents()' cannot be found. Can someone help! thanks. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Shortcut Keys | Excel Programming | |||
Macro Shortcut Key Conflicts with Application Shortcut Keys | Excel Programming | |||
Macro Shortcut Key Conflicts with Application Shortcut Keys | Excel Programming | |||
Shortcut Keys | Excel Programming | |||
Shortcut Keys | Excel Programming |