Click here to Skip to main content
15,885,110 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a unique need for a dynamic hyperlink but not related to text that you can match. I want to be able to enter R1C1 Coordinates in a cell and hyperlink to that cell within the same worksheet. I don’t believe it can be done with the standard hyperlink because the coordinates will vary, I think this needs to be created as a macro and assigned a button or some other form. if necessary, we might have to separate the Column and Row entries, example;
instead of BC2006 entered in the same cell, enter the column "BC" and row "2006" in separate cells

What I have tried:

Routine hyperlink functions. I've also tried using the "Address" function in conjunction with the hyperlink as a formula but that didn't work. The issue is that I need Excel to view the entry as a R1C1 Location and not text, and therefore enabling Excel to identify the coordinates before executing some form of "GoTo" command.
Posted
Updated 12-May-20 21:20pm
v2

1 solution

If i understand you well...

Try this:
VB
Option Explicit

Sub Test()
    'call AddHyperlink procedure
    AddHyperlink ThisWorkbook.Worksheets(1), "A5", "BC2006", "Go!"

End Sub

Sub AddHyperlink(wsh As Worksheet, insertInto As String, saddress As String, text2display As String)
    'adds hyperlink to a specific cell 
    wsh.Hyperlinks.Add Anchor:=wsh.Range(insertInto), _
        Address:="", _
        SubAddress:=wsh.Name & "!" & wsh.Range(saddress).AddressLocal, _
        ScreenTip:=text2display, _
        TextToDisplay:=wsh.Range(saddress).AddressLocal(ReferenceStyle:=xlR1C1)
End Sub
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900