PC Review


Reply
Thread Tools Rate Thread

Copy actual URL from hyperlink cell

 
 
IAN
Guest
Posts: n/a
 
      10th Oct 2007
I have a spreadsheet with thousands of records. One column contains
hyperlinks either created manually using the Insert->Hyperlink action
or via a =HYPERLINK() dynamic formula.

I need to return the URL for the cyperlink column into another column
so that I can use it for some other purpose. The new cells would
simply contain text like http://website/folder/file.htm.

I couldn't find a function that returned the URL, so I'm wondering if
there is another way to get the info? A macro possibly?

Thanks for your help
IAN

 
Reply With Quote
 
 
 
 
Nick Hodge
Guest
Posts: n/a
 
      10th Oct 2007
Ian

Not sure if I understand, but the code below will iterate a pre-selected
range and if there is a hyperlink will place it's address 2 columns to the
right (change as necessary)

Sub MoveHyper()
Dim myCell As Range
Dim hyLink As Hyperlink

For Each myCell In Selection
If myCell.Hyperlinks.Count > 0 Then
Set hyLink = myCell.Hyperlinks(1)
myCell.Offset(0, 2).Hyperlinks.Add myCell.Offset(0, 2),
hyLink.Address
Set hyLink = Nothing
End If
Next myCell
End Sub

--

HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
(E-Mail Removed)DTHIS
web: www.nickhodge.co.uk
blog (non tech): www.nickhodge.co.uk/blog


"IAN" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I have a spreadsheet with thousands of records. One column contains
> hyperlinks either created manually using the Insert->Hyperlink action
> or via a =HYPERLINK() dynamic formula.
>
> I need to return the URL for the cyperlink column into another column
> so that I can use it for some other purpose. The new cells would
> simply contain text like http://website/folder/file.htm.
>
> I couldn't find a function that returned the URL, so I'm wondering if
> there is another way to get the info? A macro possibly?
>
> Thanks for your help
> IAN
>


 
Reply With Quote
 
papou
Guest
Posts: n/a
 
      10th Oct 2007
Hello Ian
You don't say whether you actually want the other column to show URL value
as hyperlink?
Anyway amend this code and try and see if it suits your needs:

Sub PlaceUrls()
Dim rg As Range
For Each rg In Range("C1:C10")
If rg.Hyperlinks.Count <> 0 Then
rg.Offset(0, 1).Value = rg.Hyperlinks(1).Address
End If
Next rg
End Sub

HTH
Cordially
Pascal

"IAN" <(E-Mail Removed)> a écrit dans le message de news:
(E-Mail Removed)...
>I have a spreadsheet with thousands of records. One column contains
> hyperlinks either created manually using the Insert->Hyperlink action
> or via a =HYPERLINK() dynamic formula.
>
> I need to return the URL for the cyperlink column into another column
> so that I can use it for some other purpose. The new cells would
> simply contain text like http://website/folder/file.htm.
>
> I couldn't find a function that returned the URL, so I'm wondering if
> there is another way to get the info? A macro possibly?
>
> Thanks for your help
> IAN
>



 
Reply With Quote
 
=?Utf-8?B?R2FyeScncyBTdHVkZW50?=
Guest
Posts: n/a
 
      10th Oct 2007
Here is a function to put in the other column. Will handle both Inserted
hyperlinks and SIMPLE hyperlink functions:

Function hyp(r As Range) As String
Dim s As String

If r.HasFormula Then
s = r.Formula
MsgBox (s)
s_array = Split(s, Chr(34))
hyp = s_array(1)
Else
hyp = r.Hyperlinks(1).Address
End If
End Function

--
Gary''s Student - gsnu200749


"IAN" wrote:

> I have a spreadsheet with thousands of records. One column contains
> hyperlinks either created manually using the Insert->Hyperlink action
> or via a =HYPERLINK() dynamic formula.
>
> I need to return the URL for the cyperlink column into another column
> so that I can use it for some other purpose. The new cells would
> simply contain text like http://website/folder/file.htm.
>
> I couldn't find a function that returned the URL, so I'm wondering if
> there is another way to get the info? A macro possibly?
>
> Thanks for your help
> IAN
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: I can't get the hyperlink character style to apply to an actual hyperlink. Suzanne S. Barnhill Microsoft Word New Users 1 9th Sep 2011 03:07 PM
RE: copy a hyperlink to another cell Mike H Microsoft Excel Programming 0 20th Mar 2010 03:52 PM
Copy actual URL from hyperlink cell IAN Microsoft Excel Discussion 3 10th Oct 2007 06:07 PM
Copy hyperlink from one cell to/as hyperlink in another cell YogS Microsoft Excel Worksheet Functions 6 12th Jan 2006 11:57 PM
Hyperlink formula appearing but not actual hyperlink =?Utf-8?B?RGFuaWVsbGU=?= Microsoft Excel Worksheet Functions 2 20th Nov 2003 06:44 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:07 AM.