How to Send Excel Cell Text to Keyboard Macros

How to Send Excel Cell Text to Keyboard Macros thumbnail
A keyboard shortcut can save you time.

If you have a large amount of Excel text that you find yourself constantly entering into cells, you may find it faster to assign a keyboard shortcut to the task. It's possible to replace repetitive tasks, like entering the same text over and over again, with a keyboard shortcut with Microsoft's Visual Basic for Applications (VBA). VBA is a programming language specifically designed for Microsoft Office applications, including Microsoft Excel.

Things You'll Need

  • Excel 2007 or Excel 2010
Show More

Instructions

    • 1

      Press the "Alt" and "F11" keys from Excel to open the Visual Basic Editor (VBE).

    • 2

      Click "Insert" on the toolbar, then click "Module" to open a blank window.

    • 3

      Cut and paste the following code into the blank window:

      Sub Texttocell()

      ' Texttocell Macro

      ' Keyboard Shortcut: Ctrl+o

      ActiveCell.FormulaR1C1 = "this is text in the cell the cursor is on"

      End Sub

    • 4

      Tailor the code to suit your needs. For example, the code inserts the text "this is text in the cell the cursor is on" into the active cell, or the cell your cursor is on. Change the text to the text you would like to assign to the keyboard macro.

    • 5

      Change the shortcut key. From the Excel workbook, click the "Developer" tab, then click "Macros," then click "Options." Type a keyboard shortcut into the "Shortcut key" box and then click "OK."

Tips & Warnings

  • If you don't see the "Developer" tab in Excel, you may need to add it. Click the "Microsoft Office" Button and then click "Excel Options." Click "Popular" and then select the "Show Developer Tab in the Ribbon" check box

Related Searches:

References

  • Photo Credit keyboard image by Fyerne from Fotolia.com

Comments

You May Also Like

Related Ads

Featured