+ Reply to Thread
Results 1 to 9 of 9

VBA to incorporate a hyperlink to another tab

  1. #1
    Registered User
    Join Date
    10-22-2012
    Location
    Denver, CO
    MS-Off Ver
    Excel 2010
    Posts
    7

    VBA to incorporate a hyperlink to another tab

    Hello!

    I'm new to VBA and need some help. I have a spreadsheet with many tabs (one for each deal I'm working on) all based off of a Template. I click a button and this macro (below) creates a copy of the template and prompts me to rename it to my new deal name. I'm making a 'home page' to make it easier to navigate and all my deal names will be in column E. What I want is to be able to run this macro, click the deal name I've just typed in column E, create the new template tab for this deal, AND hyperlink to the tab it just made. What I'm missing here is the hyperlink part. Any help would be much appreciated!

    Please Login or Register  to view this content.
    Last edited by davesexcel; 02-22-2013 at 08:19 PM.

  2. #2
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: VBA to incorporate a hyperlink to another tab

    This macro will create the hyperlink in your Home Page tab after the last hyperlink in column E.
    Please Login or Register  to view this content.
    Pierre Leclerc
    _______________________________________________________

    If you like the help you got,
    Click on the STAR "Add reputation" icon at the bottom.

  3. #3
    Registered User
    Join Date
    10-22-2012
    Location
    Denver, CO
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: VBA to incorporate a hyperlink to another tab

    I appreciate you taking a look at this. I'm getting 2 errors.
    1) The hyperlink won't work whenever my deal name has a space in it, which many will need to have.
    2) Instead of hyperlinking the cell I've typed in column E, it adds the hyperlink in a new cell in the next available row.

    Is there a way around these 2 things? Thanks for your help!

  4. #4
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: VBA to incorporate a hyperlink to another tab

    Do you mean that in your home page, a specific cell in column E would already be selected before you start this macro?

  5. #5
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: VBA to incorporate a hyperlink to another tab

    This modification will make it works well with spces in tab names.
    Also, it will create the link to the active cell in column E of the Home Page tab.
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    10-22-2012
    Location
    Denver, CO
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: VBA to incorporate a hyperlink to another tab

    The way you have it setup now would work fine if there wasn't already a very long list of deal names in column E (I'm automating an existing spreadsheet) and it could work with spaces. When I click the button to run the macro, I'd like to be prompted for the cell, then I'll click the cell in column E that has the deal name I'm working on to get a template made for it, and finally I want it to automatically hyperlink to the tab it just made.

  7. #7
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: VBA to incorporate a hyperlink to another tab

    OK, I think I understand.
    You actually do not want the inputbox asking the sheet name as in your code.
    The cell selected in column E will already have the new tab name. Right?
    What is the problem of selecting this cell first before running the macro?

  8. #8
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: VBA to incorporate a hyperlink to another tab

    Now I think I got what you are looking for.
    Please Login or Register  to view this content.
    It should be it.
    Hope this helps.

  9. #9
    Registered User
    Join Date
    10-22-2012
    Location
    Denver, CO
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: VBA to incorporate a hyperlink to another tab

    PERFECT! As to why I didn't want to be required to select the cell first - its because my boss is an older guy who is not technologically savvy. Trying to keep it simple. This is just what I was looking for. Your code above had a typo in it where it was still referencing sName in one spot. I changed it to Rng1 and its good to go. Thanks for your help on this!

    Final vba if anyone else wants it:

    Please Login or Register  to view this content.
    Last edited by jake14569; 02-22-2013 at 11:48 PM.

+ 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