0

I have a column which has values A, B, and C in a Sheet called Demo. There are other three sheets with the same name as the column values. I want to create a hyperlink using excel formula which would refer to the sheets A, B, and C. I tried with this =HYPERLINK("#'"&A2&"'!A2","Link") But this would have another column which will have a friendly name as Link. Is it possible to refer to the same values without using any other column in Sheet Demo?

6
  • If I understood well, you wish that cells could contain both a hyperlink formula and a value. Am I correct ? Commented Mar 7, 2018 at 22:02
  • Yes, you are right Commented Mar 7, 2018 at 22:04
  • Well I tought you could not. BUT you can, as long as you can nest the value (or the equation/formula producing this value) into the friendly name. Without quotes. Commented Mar 7, 2018 at 22:19
  • 1
    do you mean something like =HYPERLINK("#'"&A2&"'!A2","Link to "&A2) Commented Mar 7, 2018 at 22:23
  • 1
    @chrisneilsen Exactly what I ended up doing now. Thanks! Additionally, we have to turn on the iterative calculation from File->Options->Formula->Check the box having label Enable iterative calculation so that it can understand it's a circular reference. Commented Mar 7, 2018 at 22:28

1 Answer 1

1

Although, I think it is worth considering VBA too (since you included that tag in your original question).

Private Sub Worksheet_Change(ByVal Target As Range)

    On Error GoTo restoreevents
    Application.EnableEvents = False

    Dim sn As String: Const hf As String = "=HYPERLINK(""#'{ref}'!A2"",""{ref}"")"
    With Me
        If Not Intersect(Target, .Range("A2:A4")) Is Nothing _
        And Len(Target.Value2) <> 0 Then
            sn = Target.Value2
            Application.Undo
            Target.Formula = Replace(hf, "{ref}", sn)
        End If
    End With

restoreevents:
    Application.EnableEvents = True

End Sub

Above code will hyperlink using formula once you type the Sheet name on the target ranges.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.