How to assign a short cut key for user defined word?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Please inform me how to assign a single desired key, when pressed to input
long data.

For eg:
Assign key "A" to input 377.88998774, instead of typing in the cells several
times
 
Insert | Name | Define
Name: A
Refers to: 377.88998774

In cells use as in:
=A
=2*A-25
etc
best wishes
 
You can do that during the process of recording a new macro.


Tools | Macro | Record New Macro
In the dialog that appears you can assign a name to the macro and choose
what key to press in combination with the [Ctrl] key to quickly run that
macro in the future.
Once you've done that, decide if you want this to be available in the
workbook you are working in only, or if you want it available all the time.
Click OK and perform the operation: simply type the value into a cell and
press the [Enter] key, then click the [Stop Recording] button (or if you
don't see that, use Tools | Macro | Stop Recording).

You'll probably need to modify the code generated a little bit because when
you pressed the [Enter] key during the recording (you had to, trust me) the
macro recorded which cell was selected after entering the value and that
became part of the macro. Easy way to edit it:
Tools | Macro | Macros
Highlight the macro you recorded and click the [Edit] button.

In the code you'll probably see something like:

ActiveCell.FormulaR1C1 = 377.88998774
Range("A2").Select

Simply delete the Range("A2").Select line of the code and close the VB
Editor. Now it will work to place the value in what ever cell you have
selected when you call the macro without always jumping back to cell "A2" (or
whatever cell reference was in the macro you recorded).
 
Maybe you can use Tools|AutoCorrect Options|AutoCorrect tab

But use a nice unique value to be replaced with your number:

Say ..a with 377.88998774

Be aware that the autocorrect list is used by all of the office suite of
programs (Word, excel, PPT, ...)
 
If you mean to be used in a formula then Define the name A as 377.88998774.
If you mean entered in to a cell on its own then use the Macro:

Sub EnterIt()
ActiveCell.Value = 377.88998774
End Sub

and asign the shortcut key you want to use.

Post back if you need further help.

--
HTH

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings

(e-mail address removed)
Replace @mailinator.com with @tiscali.co.uk
 
Back
Top