Solved

VBA - Shortcut Key

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

Industry Leaders: 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

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 …
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

710 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