Solved

VBA - Shortcut Key

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
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.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
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…

840 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