Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 328
Default Extracting URL from Hyperlink

I have a spreadsheet with several hundred website entries listed. Each one
of them is a hyperlink where the hyperlink displays as "xyz company". In
order to extract the URL to a different cell, I have to right click, select
"Edit Hyperlink" then highlight the URL and copy it, hit cancel, and then
paste the URL into another cell.

Is there an easier way?

Excel 2003 SP2
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default Extracting URL from Hyperlink

Lisa,

You could use this UDF.
Alt+F11 to open VB editor
Right click 'This Workbook'
Insert Module
Paste this in on the right

Function GetLink(HyperlinkCell As Range)
GetLink = Replace(HyperlinkCell.Hyperlinks(1).Address, "mailto:", "")
End Function

Enter the formula
=GetLink(A1) in a cell to return the underlying address of a hyperlink in
that cell

Mike

"Lisa" wrote:

I have a spreadsheet with several hundred website entries listed. Each one
of them is a hyperlink where the hyperlink displays as "xyz company". In
order to extract the URL to a different cell, I have to right click, select
"Edit Hyperlink" then highlight the URL and copy it, hit cancel, and then
paste the URL into another cell.

Is there an easier way?

Excel 2003 SP2

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Extracting URL from Hyperlink

Here is a User Defined Function that will return a URL:

Function hyp(r As Range) As String
hyp = ""
If r.Hyperlinks.Count 0 Then
hyp = r.Hyperlinks(1).Address
Exit Function
End If
If r.HasFormula Then
rf = r.Formula
dq = Chr(34)
If InStr(rf, dq) = 0 Then
Else
hyp = Split(r.Formula, dq)(1)
End If
End If
End Function
--
Gary''s Student - gsnu200796


"Lisa" wrote:

I have a spreadsheet with several hundred website entries listed. Each one
of them is a hyperlink where the hyperlink displays as "xyz company". In
order to extract the URL to a different cell, I have to right click, select
"Edit Hyperlink" then highlight the URL and copy it, hit cancel, and then
paste the URL into another cell.

Is there an easier way?

Excel 2003 SP2

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 328
Default Extracting URL from Hyperlink

Perfection!! You just saved me hours!! Thanks!

"Mike H" wrote:

Lisa,

You could use this UDF.
Alt+F11 to open VB editor
Right click 'This Workbook'
Insert Module
Paste this in on the right

Function GetLink(HyperlinkCell As Range)
GetLink = Replace(HyperlinkCell.Hyperlinks(1).Address, "mailto:", "")
End Function

Enter the formula
=GetLink(A1) in a cell to return the underlying address of a hyperlink in
that cell

Mike

"

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default Extracting URL from Hyperlink

Glad I could help

"Lisa" wrote:

Perfection!! You just saved me hours!! Thanks!

"Mike H" wrote:

Lisa,

You could use this UDF.
Alt+F11 to open VB editor
Right click 'This Workbook'
Insert Module
Paste this in on the right

Function GetLink(HyperlinkCell As Range)
GetLink = Replace(HyperlinkCell.Hyperlinks(1).Address, "mailto:", "")
End Function

Enter the formula
=GetLink(A1) in a cell to return the underlying address of a hyperlink in
that cell

Mike

"

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't make hyperlink function work for hyperlink to website Frank B Denman Excel Worksheet Functions 15 February 5th 07 11:01 PM
How do I create a hyperlink to a cell with the hyperlink function S. Bevins Excel Worksheet Functions 2 July 20th 06 08:06 PM
Moving rows with Hyperlink doesn't move hyperlink address Samad Excel Discussion (Misc queries) 15 June 22nd 06 12:03 PM
Extracting hyperlink from a cell giraph Excel Worksheet Functions 1 February 11th 06 06:11 PM
Intra-workbook hyperlink: macro/function to return to hyperlink ce marika1981 Excel Discussion (Misc queries) 3 May 6th 05 05:47 AM


All times are GMT +1. The time now is 04:27 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"