View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.newusers
 
Posts: n/a
Default insert certain terms via hotkeys

The following reassigns macros to the 3 function keys:

Sub turnOnF2()
Application.OnKey "{F2}", "HelloMacro"
End Sub

Sub turnOnF3()
Application.OnKey "{F3}", "GoodDayMacro"
End Sub

Sub turnOnF5()
Application.OnKey "{F5}", "SeeYouMacro"
End Sub

=============================================

The following are the actual macros themselves that enter the text:

Sub HelloMacro()
ActiveCell.Formula = "Hello"
End Sub

Sub GoodDayMacro()
ActiveCell.Formula = "Good Day"
End Sub

Sub SeeYouMacro()
ActiveCell.Formula = "See You"
End Sub

=============================================

The following allows you to return the function keys to their
original state:

Sub turnOffF2()
Application.OnKey "{F2}"
End Sub

Sub turnOffF3()
Application.OnKey "{F3}"
End Sub

Sub turnOffF5()
Application.OnKey "{F5}"
End Sub

=============================================

Type this macro in the VBE, then exit the VBE back to the worksheet
screen.


Sub GoodLuckMacro()
ActiveCell.Formula = "See You"
End Sub


Now do the menu sequence ToolsMacroMacros, and find the macro
in the list. Click it just once just to highlight it. Click the
Options button.
Enter a lowercase "k" for the shortcut key. This assigns Ctrl+K as the
shortcut key to enter the text "See You". (If you enter an uppercase
"K", then Ctrl+Shift+K becomes the shortcut key.)


I hope this helps you.