Move Hyperlinks

  • Hi,

    I am writing a macro for work and I cannot seem to move a hyperlink. Here is the situation.
    We have one sheet that is full of data (on a tab labeled Data). In the same workbook we have one row of the data formatted into a cover sheet. Some of the cells in the data sheet contain hyperlinks to pdf files (charts and graphs). I wrote a macro to move the data in the row of my choice to the correct cell in the cover sheet, but the hyperlinks don't transfer, only the words do. Does anyone know how to move the actual hyperlink to a different cell while keeping the text that calls the hyperlink the same. For instance if I have the word CHART linked to a chart in the data sheet, I want to put the word CHART in a specific cell on the cover sheet and still have it link to the correct chart. Thanks for the help.

  • Re: Moving A Hyperlink

    Can you post you code?

    Without seeing it, I would say you're copying the row using ".Value". You should instead try ".FormulaR1C1".

    If that doesnt work, then you may have to make the cell a hyperlink again after you copy the data over. Post your code and I'll look at it.

    I believe the code for adding a hyperlink to a cell in VBA is

    ActiveSheet.Hyperlinks.Add Anchor:=cell, Address:="url", TextToDisplay:="txt"
  • Re: Moving A Hyperlink

    Well right now I have the hyperlinks manually inserted into the data tab. I just need to copy what is in the data tab into the cover sheet tab. To do this I am using the following code: [ Worksheets("Cover Sheet").Range("E9").Offset(n, 0).Value = Worksheets("Data").Cells(Row, c).Value]
    The code is in a loop so it goes for as long as I need. The problem is some cells in the data sheet contain regular text or numbers, while some have hyperlinks. The code copies the text displayed for the hyperlink, but not the link itself.

  • Re: Moving A Hyperlink

    dude.. read my post:

    "Without seeing it, I would say you're copying the row using ".Value". You should instead try ".FormulaR1C1"."

    Try that and see if it works.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!