+ Reply to Thread
Results 1 to 7 of 7

How to hyperlink cell value to worksheet with the same name?

Hybrid View

  1. #1
    Registered User
    Join Date
    06-10-2011
    Location
    United States, New York
    MS-Off Ver
    Excel 2003
    Posts
    14

    How to hyperlink cell value to worksheet with the same name?

    I am attempting to have Excel VBA identify the name in the active cell and hyperlink that cell to a sheet within the same workbook that has the same name as the cell?

    For example:

    Cell A5 contains the value "Europe"
    There exists a sheet in the same workbook entitled "Europe"
    I would like to have excel identify the name and match it to the sheet with the same name, then Hyperlink the cell to the sheet.

    Is this possible? If so could some one walk me through how to write such code?

    Thx, J
    Last edited by J1s; 06-16-2011 at 04:28 PM.

  2. #2
    Valued Forum Contributor Miraun's Avatar
    Join Date
    04-03-2009
    Location
    New England
    MS-Off Ver
    2003, 2007, 2010, 2013
    Posts
    554

    Re: How to hyperlink cell value to worksheet with the same name?

    Hey J1s

    Let me preface this with... I'm still terrible at VBA, but I'm trying!

    I've written up a couple lines of code that will work if you run the macro on the activecell that you're trying to link to another sheet in the workbook.

    I didn't create an error routine if the names are off or anything though... I assume you can figure out that there's a problem if you get a runtime error.

    Anyway, here's the code!

    Dim Page As String
    
        Page = ("" & ActiveCell.Value & "!A1")
        ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="", SubAddress:=Page
                   
    End Sub
    Hope this helps, or gives you a little insight for your project!
    Going for Guru! Click the Star to the bottom left of this post if I helped!

  3. #3
    Registered User
    Join Date
    06-10-2011
    Location
    United States, New York
    MS-Off Ver
    Excel 2003
    Posts
    14

    Re: How to hyperlink cell value to worksheet with the same name?

    The code works perfectly!! You saved me hours of trial and error. Thank you Miraun.

  4. #4
    Registered User
    Join Date
    07-22-2011
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    1

    Smile Re: How to hyperlink cell value to worksheet with the same name?

    Hi Miraun,

    I am new to this forum just joint today. I exactly got the code which I wanted. This is really great!!!!! But I have slightly different requirement. Is it possible to select more than one cell and link with the same tabs? For eg. I have below values in the cells and same tab names. If I use the code which you provided doesn't work it gives error. If I individually do for each cell then it will take a longtime because my sheet has more than 200 values. Any help would be greatly appreciated.

    Thanks

    12345
    12346
    12347
    12348

  5. #5
    Registered User
    Join Date
    03-09-2014
    Location
    muscle shoals, al
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: How to hyperlink cell value to worksheet with the same name?

    Hello All, this code worked great. Is there a way I can have a cell value on sheet one hyperlink to the same value on sheet 2?

  6. #6
    Registered User
    Join Date
    04-17-2014
    Location
    northern NJ
    MS-Off Ver
    Excel 2010
    Posts
    1

    Re: How to hyperlink cell value to worksheet with the same name?

    I know this is a kind of old thread, but this is exactly what I'm trying to do, link cells to tabs which match the cell contents.
    I tried the VBA code above, and get "compile error - invalid outside procedure" highlighting the first pair of "". I'm not a VBA programmer, was just looking for a way to do this, so I'm not sure how to fix this. I'm using Excel 2010. Thanks for any assistance...

  7. #7
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,960

    Re: How to hyperlink cell value to worksheet with the same name?

    @Julie Brook: Please start your own thread
    Ben Van Johnson

+ 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