none
set hyperlink as per cell value RRS feed

  • Question

  • Hi,

    How can I create a hyperlink to a worksheet within the same workbook using the cell contents (value).

    Example

    Cell A1 Value is "Test1" the hyperlink should take to the user to sheet1!A1

    Cell A1 Value is "Test2" the hyperlink should take to the user to sheet2!A1

    better would be to have a button which "Go To" which woudl send the user to the respective sheet on click...

    Any help is very much appreciated

    Thursday, February 28, 2013 12:01 PM

Answers

  • "better would be to have a button"

    Put a shape on the sheet where you want cell A1 to control the destination, and assign it this macro:

    Sub GoToMacro()

        If Range("A1").Value = "Test1" Then
            Application.Goto Worksheets("Sheet1").Range("A1")
            Exit Sub
        End If
        If Range("A1").Value = "Test2" Then
            Application.Goto Worksheets("Sheet2").Range("A1")
            Exit Sub
        End If

    End Sub

    • Marked as answer by vdafonse Thursday, February 28, 2013 3:13 PM
    Thursday, February 28, 2013 2:02 PM

All replies

  • "better would be to have a button"

    Put a shape on the sheet where you want cell A1 to control the destination, and assign it this macro:

    Sub GoToMacro()

        If Range("A1").Value = "Test1" Then
            Application.Goto Worksheets("Sheet1").Range("A1")
            Exit Sub
        End If
        If Range("A1").Value = "Test2" Then
            Application.Goto Worksheets("Sheet2").Range("A1")
            Exit Sub
        End If

    End Sub

    • Marked as answer by vdafonse Thursday, February 28, 2013 3:13 PM
    Thursday, February 28, 2013 2:02 PM
  • Many Thanks Bernie,

    Feel like a "donkey" easier than what I thought would be I am doing a big report with too many restrictions and permissions that never think to do the more obvious way :-)

    Regards,

    Thursday, February 28, 2013 3:14 PM