#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22
Default Hot Keys

I have a macro that I would like to fire by hitting the 'Control 1' keys.
How do I begin?

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,173
Default Hot Keys

Check out the Onkey method, this re-purposes the built in Excel keys

Sub test()
'Re-puposes
Application.OnKey "^1", "MyCode"
End Sub

Sub myCode()
MsgBox "It ran with Ctrl+1"
End Sub


--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
www.nickhodge.co.uk


"Inspector" wrote in message
...
I have a macro that I would like to fire by hitting the 'Control 1' keys.
How do I begin?

Thanks


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22
Default Hot Keys

Okay, so here are my 2 macros....I need the first one to be fired by 'Control
1' and the second to be fired by 'Control 2'. How would I integrate your
suggestion into this VB code? BTW I know very little about this.


Sub sortprintareaonlyp()
With ActiveSheet.Range("Print_Area")
.Sort Key1:=.Cells(2, 16), Order1:=xlDescending
ActiveSheet.PrintOut
.Sort Key1:=.Cells(2, 17), Order1:=xlAscending
End With
End Sub

Sub sortprintareaonlys()
With ActiveSheet.Range("Print_Area")
.Sort Key1:=.Cells(2, 16), Order1:=xlDescending
End With
End Sub

"Nick Hodge" wrote:

Check out the Onkey method, this re-purposes the built in Excel keys

Sub test()
'Re-puposes
Application.OnKey "^1", "MyCode"
End Sub

Sub myCode()
MsgBox "It ran with Ctrl+1"
End Sub


--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
www.nickhodge.co.uk


"Inspector" wrote in message
...
I have a macro that I would like to fire by hitting the 'Control 1' keys.
How do I begin?

Thanks



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,173
Default Hot Keys

Inspector

Have a third to set them, run it and they will be set.

Sub AssignKeys
With Application
.OnKeys "^1","sortprintareaonlyp"
.OnKeys "^2","sortprintareaonlys"
End With
End Sub

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
www.nickhodge.co.uk


"Inspector" wrote in message
...
Okay, so here are my 2 macros....I need the first one to be fired by
'Control
1' and the second to be fired by 'Control 2'. How would I integrate your
suggestion into this VB code? BTW I know very little about this.


Sub sortprintareaonlyp()
With ActiveSheet.Range("Print_Area")
.Sort Key1:=.Cells(2, 16), Order1:=xlDescending
ActiveSheet.PrintOut
.Sort Key1:=.Cells(2, 17), Order1:=xlAscending
End With
End Sub

Sub sortprintareaonlys()
With ActiveSheet.Range("Print_Area")
.Sort Key1:=.Cells(2, 16), Order1:=xlDescending
End With
End Sub

"Nick Hodge" wrote:

Check out the Onkey method, this re-purposes the built in Excel keys

Sub test()
'Re-puposes
Application.OnKey "^1", "MyCode"
End Sub

Sub myCode()
MsgBox "It ran with Ctrl+1"
End Sub


--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
www.nickhodge.co.uk


"Inspector" wrote in message
...
I have a macro that I would like to fire by hitting the 'Control 1'
keys.
How do I begin?

Thanks




  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22
Default Hot Keys

Sorry for being so numb but this is what I have now and when I hit 'Control
1' I get a pop up to format cells.

Sub sortprintareaonlyp()
With ActiveSheet.Range("Print_Area")
.Sort Key1:=.Cells(2, 16), Order1:=xlDescending
ActiveSheet.PrintOut
.Sort Key1:=.Cells(2, 17), Order1:=xlAscending
End With
End Sub

Sub sortprintareaonlys()
With ActiveSheet.Range("Print_Area")
.Sort Key1:=.Cells(2, 16), Order1:=xlDescending
End With
End Sub

Sub AssignKeys()
With Application
.OnKeys "^1", "sortprintareaonlyp"
.OnKeys "^2", "sortprintareaonlys"
End With
End Sub

"Nick Hodge" wrote:

Inspector

Have a third to set them, run it and they will be set.

Sub AssignKeys
With Application
.OnKeys "^1","sortprintareaonlyp"
.OnKeys "^2","sortprintareaonlys"
End With
End Sub

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
www.nickhodge.co.uk


"Inspector" wrote in message
...
Okay, so here are my 2 macros....I need the first one to be fired by
'Control
1' and the second to be fired by 'Control 2'. How would I integrate your
suggestion into this VB code? BTW I know very little about this.


Sub sortprintareaonlyp()
With ActiveSheet.Range("Print_Area")
.Sort Key1:=.Cells(2, 16), Order1:=xlDescending
ActiveSheet.PrintOut
.Sort Key1:=.Cells(2, 17), Order1:=xlAscending
End With
End Sub

Sub sortprintareaonlys()
With ActiveSheet.Range("Print_Area")
.Sort Key1:=.Cells(2, 16), Order1:=xlDescending
End With
End Sub

"Nick Hodge" wrote:

Check out the Onkey method, this re-purposes the built in Excel keys

Sub test()
'Re-puposes
Application.OnKey "^1", "MyCode"
End Sub

Sub myCode()
MsgBox "It ran with Ctrl+1"
End Sub


--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
www.nickhodge.co.uk


"Inspector" wrote in message
...
I have a macro that I would like to fire by hitting the 'Control 1'
keys.
How do I begin?

Thanks






  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 176
Default Hot Keys

Try:

<Tools<Macro<Macros...
Select your sub
Click "Options"
Enter your keyboard shortcut

--
Regards,
Dave


"Inspector" wrote:

I have a macro that I would like to fire by hitting the 'Control 1' keys.
How do I begin?

Thanks

  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,173
Default Hot Keys

Inspector

Did you run (ToolsMacrosMacros...run the AssignKeys code. Do this first
and you should find the keys re-purposed

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
www.nickhodge.co.uk


"Inspector" wrote in message
...
Sorry for being so numb but this is what I have now and when I hit
'Control
1' I get a pop up to format cells.

Sub sortprintareaonlyp()
With ActiveSheet.Range("Print_Area")
.Sort Key1:=.Cells(2, 16), Order1:=xlDescending
ActiveSheet.PrintOut
.Sort Key1:=.Cells(2, 17), Order1:=xlAscending
End With
End Sub

Sub sortprintareaonlys()
With ActiveSheet.Range("Print_Area")
.Sort Key1:=.Cells(2, 16), Order1:=xlDescending
End With
End Sub

Sub AssignKeys()
With Application
.OnKeys "^1", "sortprintareaonlyp"
.OnKeys "^2", "sortprintareaonlys"
End With
End Sub

"Nick Hodge" wrote:

Inspector

Have a third to set them, run it and they will be set.

Sub AssignKeys
With Application
.OnKeys "^1","sortprintareaonlyp"
.OnKeys "^2","sortprintareaonlys"
End With
End Sub

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
www.nickhodge.co.uk


"Inspector" wrote in message
...
Okay, so here are my 2 macros....I need the first one to be fired by
'Control
1' and the second to be fired by 'Control 2'. How would I integrate
your
suggestion into this VB code? BTW I know very little about this.


Sub sortprintareaonlyp()
With ActiveSheet.Range("Print_Area")
.Sort Key1:=.Cells(2, 16), Order1:=xlDescending
ActiveSheet.PrintOut
.Sort Key1:=.Cells(2, 17), Order1:=xlAscending
End With
End Sub

Sub sortprintareaonlys()
With ActiveSheet.Range("Print_Area")
.Sort Key1:=.Cells(2, 16), Order1:=xlDescending
End With
End Sub

"Nick Hodge" wrote:

Check out the Onkey method, this re-purposes the built in Excel keys

Sub test()
'Re-puposes
Application.OnKey "^1", "MyCode"
End Sub

Sub myCode()
MsgBox "It ran with Ctrl+1"
End Sub


--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
www.nickhodge.co.uk


"Inspector" wrote in message
...
I have a macro that I would like to fire by hitting the 'Control 1'
keys.
How do I begin?

Thanks





  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22
Default Hot Keys

Perfect! thank you!!!

"David Billigmeier" wrote:

Try:

<Tools<Macro<Macros...
Select your sub
Click "Options"
Enter your keyboard shortcut

--
Regards,
Dave


"Inspector" wrote:

I have a macro that I would like to fire by hitting the 'Control 1' keys.
How do I begin?

Thanks

  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
CLR CLR is offline
external usenet poster
 
Posts: 1,998
Default Hot Keys

Hi David...........

I tried this several times with different Excel files (XL97, SR2), and each
time I got a complete Excel crash...........

It did work in XP tho.............

Vaya con Dios,
Chuck, CABGx3



"David Billigmeier" wrote:

Try:

<Tools<Macro<Macros...
Select your sub
Click "Options"
Enter your keyboard shortcut

--
Regards,
Dave


"Inspector" wrote:

I have a macro that I would like to fire by hitting the 'Control 1' keys.
How do I begin?

Thanks

Reply
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
Disable CUT via toolbars or shortcut keys sparx Excel Discussion (Misc queries) 0 April 30th 06 08:34 PM
my arrow keys don't work. bulkmailman Excel Discussion (Misc queries) 1 December 3rd 05 11:13 PM
Deactivate shortcut keys in excel.. areddy Excel Discussion (Misc queries) 1 October 25th 05 02:37 PM
Cursor Keys does not change cell focus Skypilot Excel Discussion (Misc queries) 3 February 24th 05 07:13 AM
How to make [toggling] shortcut keys to superscript and subscript, respectively? Mann Lee Excel Discussion (Misc queries) 8 December 13th 04 01:50 PM


All times are GMT +1. The time now is 05:35 AM.

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

About Us

"It's about Microsoft Excel"