Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Hot Keys
I have a macro that I would like to fire by hitting the 'Control 1' keys.
How do I begin? Thanks |
#2
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
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
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
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
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
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
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
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
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
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
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
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
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
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
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Disable CUT via toolbars or shortcut keys | Excel Discussion (Misc queries) | |||
my arrow keys don't work. | Excel Discussion (Misc queries) | |||
Deactivate shortcut keys in excel.. | Excel Discussion (Misc queries) | |||
Cursor Keys does not change cell focus | Excel Discussion (Misc queries) | |||
How to make [toggling] shortcut keys to superscript and subscript, respectively? | Excel Discussion (Misc queries) |