How to Use Sendkeys in Excel

Save

Excel is a spreadsheet program included in the Microsoft Office suite of productivity software. It is commonly available on PCs and Macs. In a spreadsheet, the data is managed through a series of tables where each value is placed in a separate cell. The values can be manipulated through the built-in functions or through custom functions written in Visual Basic (VBA). SendKeys is a method to capture key strokes in VBA.

Things You'll Need

  • Microsoft Excel with VBA

Using SendKeys

  • Open Excel and then press ALT+F11 to open VBA.

  • Click "Insert" then "Module" from the menu bar to insert a new module. The method can also be used in a current module. A module is simply a segment of programming code for VBA.

  • Insert the function where you want to use the SendKeys method. All function must begin with "Function" and end with "End Function".

  • To access the SendKeys method, type "Application.SendKeys(" then the keys as a string and close the method with ")". This will the send the keys to the application just as if the user had typed the keys on the keyboard.

Tips & Warnings

  • Some anti-virus programs will delete VBA macros and modules without warning. Certain methods are more susceptible to deletion, and SendKeys is one of the these methods. Check the anti-virus documentation about such actions by the anti-virus program.

References

  • Photo Credit Hemera Technologies/AbleStock.com/Getty Images
Promoted By Zergnet

Comments

You May Also Like

Related Searches

Check It Out

Geek Vs Geek: Robot battles, hoverboard drag race, and more

M
Is DIY in your DNA? Become part of our maker community.
Submit Your Work!