Solved

VBA - Shortcut Key

Posted on 2014-02-05
3
385 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

863 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

26 Experts available now in Live!

Get 1:1 Help Now