0

In Excel I have two columns say ID and Link both are text I have used the below macro.

Sub HyperAdd()

    'Converts each text hyperlink selected into a working hyperlink

    For Each xCell In Selection
        ActiveSheet.Hyperlinks.Add Anchor:=xCell, Address:=xCell.Formula
    Next xCell

End Sub

But the above macro makes current seletion cells with address same as its cell value.

So How do I get link in "ID" column with hyperling address details coming from column "Link"

3
  • Great. Rajesh. I'll move the comment to answer. Please accept so others can benefit going forward. Commented Dec 13, 2012 at 14:22
  • Please tell me how to accept at clicking on tick mark is showing popup that you can accept in three minutes but nothing happens then. Commented Dec 13, 2012 at 14:26
  • 1
    Because you are kind of new, I think there may be some timing issue with when you can accept. Try again in 3 minutes. It should work. And welcome to SO, by the way. I hope you enjoy it here. I've found it VERY useful. If it doesn't work, comment back. Commented Dec 13, 2012 at 14:28

2 Answers 2

2

I think this is want you want...

Assuming the link column is 1 cell to the right of ID...

ActiveSheet.Hyperlinks.Add Anchor:=xCell, Address:=xCell.Offset(,1)

You can adjust the offset as needed for how many columns away you are.

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

Comments

0

Column A - Column B - Column C

ABCCompany - William Smith - [email protected]

=HYPERLINK(C2, B2) William Smith will be a hyperlink with the link being wsmith@....

Check out this link. Much easier. https://www.ablebits.com/office-addins-blog/2017/03/23/excel-hyperlink-function/

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.