Hyperlink - copying

J

jijy

In Sheet1, cell A1 has the formula=Sheet2!B3. Cell A1 (Sheet1) also
contains a hyperlink that is linked to Sheet2!B3

Now what I want to do is to copy the formula & the hyperlink in
sheet1A1 down to cell A2 and all the way to cell A250.

The issue is when I do the copy, the formula is copied but the
hyperlink still points to Sheet2!B3.

Any thoughts or ideas?

Thanks a lot.

Jijy
 
G

Guest

Insert this code into a code module, then select all the cells. While
they're still selected, use Tools | Macro | Macros to choose and run the code.

Sub CreateInternalDocumentHyperlink()

Dim Cell As Object

For Each Cell In Selection

ActiveSheet.Hyperlinks.Add Anchor:=Selection, _
Address:="", _
SubAddress:=Right$(Cell.Formula, Len(Cell.Formula) - 1)

Next

End Sub
 
J

jijy

The code creates the link but when I click on the link it doesn't tak
me to the destination cell. Irrespective of which cell I click th
link, it will take me to one particular cell in Sheet2.
Is it possible to click on a cell and then the link takes you to th
exact cell where the item appears in Sheet2?

Thanks a lot for helping out
 
G

Guest

It should take you there. Let's say that the formula in a cell is
=Sheet2!B99 then the link will be set up as Address:="", SubAddress:=
"Sheet2!B99"

I just double checked this in Excel 2003 here and it works properly and
takes me to the correct cell on the other worksheet. Perhaps check the
formulas in the cells that you're working with and make sure that somehow
they didn't all end up pointing to just one place in the workbook?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top