+ Reply to Thread
Results 1 to 5 of 5

FollowHyperlink Event Macro

  1. #1
    Registered User
    Join Date
    07-11-2011
    Location
    Gatineau, QC
    MS-Off Ver
    Excel 2010
    Posts
    50

    FollowHyperlink Event Macro

    Hello,

    In my excel file, I have a series of hyperlinks on the first worksheet that link to the rest of the worksheets in the workbook. I want to hide these worksheets and only have them open when somone clicks on the hyperlink.

    To do this, I have been trying to write a macro for the FollowHyperlink event so that when somebody clicks on the hyperlink the excel sheet is made visible. The following code works:

    Sheets("sheetX").Visible = True
    Sheets("sheetX").Select

    However, I do not know how to write the code so that only the worksheet that corresponds to the hyperlink is the one that is made visible.

    Any help or tips would be greatly, greatly appreciated. I have been stuck on this all morning.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: FollowHyperlink Event Macro - Help!!

    Hello webfeet2,

    it would be easier to recommend possible solutions if you would post a copy of your workbook.

    To Attach a File:
    1. Scroll down to the window below your post Additional Options
    2. In the frame Attach Files you will see the button Manage Attachments
    3. Click the button.
    4. A new window will open titled Manage Attachments - Excel Forum.
    5. Click the Browse... button to locate your file for uploading.
    6. This will open a new window File Upload.
    7. Once you have located the file to upload click the Open button. This window will close.
    8. You are now back in the Manage Attachments - Excel Forum window.
    9. Click the Upload button and wait until the file has uploaded.
    10. Close the window and then click Submit.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    07-11-2011
    Location
    Gatineau, QC
    MS-Off Ver
    Excel 2010
    Posts
    50

    Re: FollowHyperlink Event Macro

    I found the solution to this problem. The following code works on Excel 2007 (have to wait and see with Excel 2003):
    Please Login or Register  to view this content.
    Last edited by Leith Ross; 07-13-2011 at 12:09 PM. Reason: Added Code Tags

  4. #4
    Registered User
    Join Date
    07-11-2011
    Location
    Gatineau, QC
    MS-Off Ver
    Excel 2010
    Posts
    50

    Re: FollowHyperlink Event Macro

    Hello everyone,

    I am getting an error when I try to run this piece of code in my spreadsheet. It will work for the first spreadsheet in the list (the list is all in the same column). However, for the other hyperlinks in the column, Excel returns the following message: Run Time Error 9, subscript out of range. The bug is in the following line of code:
    Please Login or Register  to view this content.
    Any help would be much appreciated.
    Last edited by Leith Ross; 07-13-2011 at 12:10 PM. Reason: Added Code Tags

  5. #5
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: FollowHyperlink Event Macro

    Hello webfeet2,

    Please wrap your code code lines using "code tags". See my signature on how to do this.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1