Apr 06 2020 12:38 PM
I have a worksheet where one column contains hyperlinks (like created with =HYPERLINK(link;text)). How can I create a formula extracting link urls from those hyperlinks? I've tried dozen of search queries and carefully read everything found, but couldn't find a way.
Apr 06 2020 01:43 PM
Hello,
Apr 06 2020 01:46 PM
Hello, you can follow the steps in the link below
https://howtouseexcel.net/how-to-extract-a-url-from-a-hyperlink-on-excel
Mar 05 2021 07:50 AM
@Abiola1 The link you provided no longer seems to work.
Mar 05 2021 09:22 AM
Mar 26 2021 02:22 PM
Here's another non-scripting method I've used for years.
1. Copy your column containing the links and paste it into a Word document.
2. Save your Word document as "Web Page (*.htm, *.html)".
3. Right-click on the .htm file and open in Notepad (to view the html source code).
4. Find the rows of code that contain your hyperlinks and copy them, then paste into a Word document.
5. Use find and replace to delete unwanted code until you are left with only the hyperlinks.
6. Create a new column next to your original column in your spreadsheet and paste them in.
7. Check the beginning and end to make certain the URLs are pasted back into the corresponding rows.
Mar 27 2021 04:32 AM
Extract actual addresses from hyperlinks with VBA code
Press on the heading to get more possibilities and options.
Hold down the ALT + F11 keys to open the Microsoft Visual Basic for Applications window.
Click Insert> Module and paste the following code into the module window.
Sub Extracthyperlinks ()
'Updateby Extendoffice
Dim Rng As Range
Dim WorkRng As Range
On Error Resume Next
xTitleId = "KutoolsforExcel"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox ("Range", xTitleId, WorkRng.Address, Type: =
For Each Rng In WorkRng
If Rng.Hyperlinks.Count> 0 Then
Rng.Value = Rng.Hyperlinks.Item (1) .Address
End If
Next
End Sub
Then press F5 when you press the key to run the code, it will bring up a dialog box for you to choose the hyperlinks that you want to extract the actual addresses from.
Then click OK and the selected cell contents will be converted to the real hyperlink addresses in the original range.
Aug 19 2021 07:44 AM - edited Aug 19 2021 07:46 AM
Sub ExtractHL()
Dim HL As Hyperlink
For Each HL In ActiveSheet.Hyperlinks
HL.Range.Offset(0, 1).Value = HL.Address
Next
End Sub
Aug 31 2021 08:11 AM
@datta9381 Thank you, that saved me some time. I just had to add the SubAddress property to get the full address of my links instead of just the domain piece:
HL.Range.Offset(0, 1).value = HL.Address & HL.SubAddress
Aug 31 2021 08:27 AM
Dec 13 2021 12:37 AM
Sub ExtractHL()
Dim HL As Hyperlink
For Each HL In ActiveSheet.Hyperlinks
HL.Range.Offset(0, 1).Value = HL.Address
Next
End Sub
Function GetURL(cell As range, _
Optional default_value As Variant)
'Lists the Hyperlink Address for a Given Cell
'If cell does not contain a hyperlink, return default_value
If (cell.range("A1").Hyperlinks.Count <> 1) Then
GetURL = default_value
Else
GetURL = cell.range("A1").Hyperlinks(1).Address & "#" & cell.range("A1").Hyperlinks(1).SubAddress
End If
End Function
For more visit esyExcel
Dec 31 2021 08:37 PM - edited Dec 31 2021 08:38 PM
Without using macros, you can follow below steps.
1. Right-click a hyperlink. You'll see a Context menu appear.
2. From the Context menu, choose Edit Hyperlink. Excel displays the Edit Hyperlink dialog box
3. Select and copy the entire URL from the Address field of the dialog box.
4. Press Escape to close the Edit Hyperlink dialog box.
5. Paste the URL into any cell desired.
With Macro
Sub ExtractHL()
Dim HL As Hyperlink
For Each HL In ActiveSheet.Hyperlinks
HL.Range.Offset(0, 1).Value = HL.Address
Next
End Sub
Function GetURL(rng As Range) As String
On Error Resume Next
GetURL = rng.Hyperlinks(1).Address
End Function
=GetURL(A1)
Hopefully you will get it solved, Follow to learn more TownTasks
Jan 01 2022 02:42 AM
As variant
=LET(
range, A1:A2,
str, FORMULATEXT( range ),
start, FIND( """", str )+1,
end, FIND( """", str, start ),
MID( str, start, end-start ) )
Jan 22 2022 07:03 PM - edited Jan 22 2022 08:20 PM
non-coding way:
Apr 03 2022 01:39 PM - edited Apr 03 2022 03:08 PM
Thanks for this. I was able to improve your method significantly.
Jun 04 2022 05:32 PM
@TownTasks the hyperlinks are not clickable unless I click twice on the cell. Could you give any hint or trick to fix this thing, please!
P.S: I tried both macro and GetURL function.
Aug 10 2022 02:16 PM
Sep 23 2022 10:21 AM
Oct 01 2022 02:05 AM
@esyexcel Thanks! a 10 second fix to something that would have otherwise taken me a few hours!
Feb 10 2023 02:18 PM
amazing work. Thank you!