How to extract URLs from hyperlinked text

ameenakbar

New Member
Joined
Mar 15, 2014
Messages
30
I have data like this.
[TABLE="width: 500"]
<tbody>[TR]
[TD]Google[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]MSN[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

in above data google and msn are hyperlink with URLs.
Now I want extract URLs in next cells, like below.
[TABLE="width: 200"]
<tbody>[TR]
[TD]Google[/TD]
[TD]https://google.com (with formula)[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]MSN[/TD]
[TD]https://msn.com[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

Is there any formula / macro or some other way.
 
Last edited:

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Hi,

Try this

Sub ExtractHyper()
Dim HP As Hyperlink
For Each HP In ActiveSheet.Hyperlinks
HP.Range.Offset(0, 1).Value = HP.Address
Next
End Sub
 
Upvote 0
Here is another macro that you can try which targets a specified range (as written, cell A1 on downward)...
Code:
[table="width: 500"]
[tr]
	[td]Sub ExtractHyperlinkAddresses()
  Dim Cell As Range
  For Each Cell In Range("[B][COLOR="#FF0000"]A1[/COLOR][/B]", Cells(Rows.Count, "[B][COLOR="#FF0000"]A[/COLOR][/B]").End(xlUp))
    Cell.Offset(, 1).Value = Cell.Hyperlinks.Item(1).Address
  Next
End Sub[/td]
[/tr]
[/table]
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top