Solved

VBA - Shortcut Key

Posted on 2014-02-05
3
396 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 22

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
After seeing numerous questions for Dynamic Data Validation I notice that most have used Visual Basic to solve the problem. This suggestion is purely formula based and can be used in multiple rows.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

623 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