Solved

VBA - Shortcut Key

Posted on 2014-02-05
3
381 Views
Last Modified: 2014-02-12
Hello Experts,

My workbook will eventually have multiple worksheets, and a worksheet called "Home".  The "Home" worksheet will serve as a starting point, with links to the other workbooks.

Is it possible to have VBA, that allows for the user maybe pressing "CTRL + H" and the user is automatically brought to the "Home" worksheet?

Thank you in advance for your help!

~ Geekamo
0
Comment
Question by:Geekamo
  • 2
3 Comments
 
LVL 20

Accepted Solution

by:
ltlbearand3 earned 500 total points
ID: 39837794
In Excel press ALT-F11 to open up the VBA window

Now add a new module to store out code (On the Menu choose Insert >> Module)
Now paste in this code:
Public Sub GoToHomeTab()
    Dim objHomeSheet As Worksheet
    Set objHomeSheet = ActiveWorkbook.Worksheets("Home")
    objHomeSheet.Activate
End Sub

Open in new window


Now close the VBA window.  
On the developer ribbon choose Macros.
Make sure GoToHomeTab is selected and click the Options Button
Assign your hot key

Now save your workbook as a macro enabled book and you are good to go.  Let me know if you have questions.
0
 
LVL 20

Expert Comment

by:ltlbearand3
ID: 39837797
By the way you can combine this idea with the idea from your other post (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28357693.html) by updating the workbook open code with this:
Private Sub Workbook_Open()
    Call GoToHomeTab
End Sub

Open in new window

0
 
LVL 21

Expert Comment

by:Ejgil Hedegaard
ID: 39848627
Using Ctrl+h as hot key, disable the normal use of Ctrl+h = Replace dialog.
Consider using Ctrl+Shift+h instead for the hot key.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now