How to extract Url and make it clickable automatically?

happydz

New Member
Joined
Jan 11, 2017
Messages
47
Office Version
  1. 2010
Hello,
I have a set of websites listed in an excel sheet, I tried to extract hyperlink using VBA code (I found it online), but I find out that they not clickable. Could you edit it or give another trick to fix this problem, please?

VBA Code:
Sub ExtractHL()
Dim HL As Hyperlink
For Each HL In ActiveSheet.Hyperlinks
HL.Range.Offset(0, 1).Value = HL.Address
Next
End Sub
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
The following works if the list of the URLs are listed as:

www.somewhere.com
www.nowhere.com
www.here.com
etc.
etc.

VBA Code:
Sub ConvertTextURLsToHyperlinks()
    Dim Cell As Range
    For Each Cell In Intersect(Selection, ActiveSheet.UsedRange)
        If Cell <> "" Then
            ActiveSheet.Hyperlinks.Add Cell, "HTTP://" & Cell.Value
        End If
    Next
End Sub

You will first need to highlight all of the cell range to be converted then run the macro.
 
Upvote 0
The following works if the list of the URLs are listed as:

www.somewhere.com
www.nowhere.com
www.here.com
etc.
etc.

VBA Code:
Sub ConvertTextURLsToHyperlinks()
    Dim Cell As Range
    For Each Cell In Intersect(Selection, ActiveSheet.UsedRange)
        If Cell <> "" Then
            ActiveSheet.Hyperlinks.Add Cell, "HTTP://" & Cell.Value
        End If
    Next
End Sub

You will first need to highlight all of the cell range to be converted then run the macro.
I tried this macro code, but it did not work.
test_hyperlinks.xlsm
ABCD
1SitesHyperlinks
2facebook
3somewhere
4nowhere
5here
6
Feuil2
 
Upvote 0
Can you post your workbook to a cloud site for download ?
 
Upvote 0
From the example list there is no reliable means of determining if the link requires a ".com" or ".net" or ".edu", etc. etc. to be added by vba.

???
 
Upvote 0
The following will work with the example you have provided. HOWEVER, keep in mind, if there is a website term that does not end in ".com", the following code will not work.

VBA Code:
'' NOTE: First select the cells for conversion, then click the button :

Sub ConvertTextURLsToHyperlinks()
    Dim Cell As Range
    For Each Cell In Intersect(Selection, ActiveSheet.UsedRange)
        If Cell <> "" Then
            ActiveSheet.Hyperlinks.Add Cell, "HTTP://" & Cell.Value & ".com"
        End If
    Next
End Sub

Also ... prior to clicking the Command Button, the cells with the website names must be highlighted (selected).
 
Upvote 0
The following will work with the example you have provided. HOWEVER, keep in mind, if there is a website term that does not end in ".com", the following code will not work.

VBA Code:
'' NOTE: First select the cells for conversion, then click the button :

Sub ConvertTextURLsToHyperlinks()
    Dim Cell As Range
    For Each Cell In Intersect(Selection, ActiveSheet.UsedRange)
        If Cell <> "" Then
            ActiveSheet.Hyperlinks.Add Cell, "HTTP://" & Cell.Value & ".com"
        End If
    Next
End Sub

Also ... prior to clicking the Command Button, the cells with the website names must be highlighted (selected).
The code works very fine; thank you.
Please!
I need a second favor from you if you don't mind.
Based on the same example where the column A contains the websites, I need the extract the hyperlinks in the column B without me clicking twise on the cell to make the hyperlink active. so the code should extracts and activates the hyperlinks from column A into column B. Would that be possible?
 
Upvote 0
I dont understand having to click twice. Here it only requires one click to initiate the link.
 
Upvote 0

Forum statistics

Threads
1,224,814
Messages
6,181,126
Members
453,021
Latest member
Justyna P

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