Copying a Hyperlink

A

ACH

I have a hyperlink in cell A1. I also want that exact same hyperlink in F1.
The scenario is the same for A2/F2, A3/F3 etc. Is there an easy way to copy
just the hyperlink from a cell without changing the text in the respective
cells?

ACH
 
D

Dave Peterson

Maybe you could use a macro:

Option Explicit
Sub testme()

Dim myRng As Range
Dim myCell As Range
Dim myOtherCell As Range

With ActiveSheet
Set myRng = .Range("a2", .Cells(.Rows.Count, "A").End(xlUp))
For Each myCell In myRng.Cells
Set myOtherCell = myCell.Offset(0, 5)
If myCell.Hyperlinks.Count > 0 Then
If myOtherCell.Hyperlinks.Count > 0 Then
myOtherCell.Hyperlinks.Delete
End If
.Hyperlinks.Add _
Anchor:=myOtherCell, _
Address:=myCell.Hyperlinks(1).Address
End If
Next myCell
End With

End Sub

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm
 

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