ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   New Users to Excel (https://www.excelbanter.com/new-users-excel/)
-   -   insert certain terms via hotkeys (https://www.excelbanter.com/new-users-excel/76117-insert-certain-terms-via-hotkeys.html)

texter

insert certain terms via hotkeys
 

Hi everyone,

I wonder how to assign certain hotkeys in order to enter a predefined
text.
What I want to do is:
Press F2 to enter the text "hello"
F3 enters "goodday"
F5 enters "see you"
CTRL+K enters "good luck"
and so on ...

Thanks in advance for your help
texter


--
texter
------------------------------------------------------------------------
texter's Profile: http://www.excelforum.com/member.php...o&userid=32290
View this thread: http://www.excelforum.com/showthread...hreadid=520435


gls858

insert certain terms via hotkeys
 
texter wrote:
Hi everyone,

I wonder how to assign certain hotkeys in order to enter a predefined
text.
What I want to do is:
Press F2 to enter the text "hello"
F3 enters "goodday"
F5 enters "see you"
CTRL+K enters "good luck"
and so on ...

Thanks in advance for your help
texter


You might want to check out this freebie:

http://www.phraseexpress.com/

gls858

[email protected]

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.


[email protected]

insert certain terms via hotkeys
 
Oops! correction to that last macro - should read:

Sub GoodLuckMacro()
ActiveCell.Formula = "Good Luck"
End Sub



All times are GMT +1. The time now is 11:29 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com