Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to copy the hyperlink of a list of cells in another column

0 views
Skip to first unread message

jaya

unread,
Oct 8, 2005, 8:13:39 AM10/8/05
to
How to copy the hyperlink of a list of cells in another column?


Dave Peterson

unread,
Oct 8, 2005, 10:12:18 AM10/8/05
to
Do you mean that you have a column with cells that have hyperlinks added via
Insert|Hyperlink?

If yes, you can use a user defined function to get that link address:

Saved from a previous post:

Here's one that may help:

Option Explicit
Function GetURL(Rng As Range) As String
Application.Volatile

Set Rng = Rng(1)

If Rng.Hyperlinks.Count = 0 Then
GetURL = ""
Else
GetURL = Rng.Hyperlinks(1).Address
End If
End Function

So if you had a hyperlink in A1, you could put =getURL(a1) in that adjacent
cell.

Be aware that if you change the hyperlink, then this formula cell won't change
until your workbook calculates.

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

Short course:

Open your workbook.
Hit alt-f11 to get to the VBE (where macros/UDF's live)
hit ctrl-R to view the project explorer
Find your workbook.
should look like: VBAProject (yourfilename.xls)

right click on the project name
Insert, then Module
You should see the code window pop up on the right hand side

Paste the code in there.

Now go back to excel.
Into a test cell and type:
=getURL(a1)

jaya wrote:
>
> How to copy the hyperlink of a list of cells in another column?

--

Dave Peterson

jaya

unread,
Oct 8, 2005, 11:11:47 AM10/8/05
to
Dave,

Your explanations are really fantastics.
Without knowing anything abour creating user defined functions I was able to
follow your short course to implement this function.
Thanks again for your precious help.
Gerald
"Dave Peterson" <pete...@verizonXSPAM.net> a écrit dans le message de news:
4347D3C2...@verizonXSPAM.net...

0 new messages