In the following dataset, we have a list of some famous e-commerce sites and their website addresses. The website links are not activated so they cannot be opened by clicking on these links. Let’s activate them as hyperlinks.
We have used Microsoft Excel 365 version here, but you can use any other versions at your convenience.
Method 1 – Using HYPERLINK Function
We can activate the links using the HYPERLINK function, but we’ll have to store the hyperlinks in a new column, Linked Address.
Steps:
- Select the range of the Linked Address column.
- Enter the following formula in D4, the first cell of the selected range:
=HYPERLINK(C4)
HYPERLINK will activate the text URL in cell C4.
- Press CTRL+ENTER.
All of the hyperlinks will be activated in the Linked Address column at once. Simply click the links to visit the websites.
Read More: How to Hyperlink Multiple Cells in Excel
Method 2 – Activate Multiple Hyperlinks Using VBA Selection Property
We can use a VBA code with the Selection property to activate the links in the Website Link column itself just by selecting them.
Steps:
- Go to the Developer Tab >> Visual Basic Option.
The Visual Basic Editor will open up.
- Go to the Insert Tab >> Module Option.
A Module will be created.
- Enter the following code in the module window:
Sub activatinglinks()
Dim w_link As Variant
For Each w_link In Selection
ActiveSheet.Hyperlinks.Add Anchor:=w_link, Address:=w_link.Formula
Next w_link
End Sub
Here, we declared w_link as a Variant. The FOR loop iterates through each cell w_link of our selection and uses the HYPERLINKS function to activate each of the text URLs in this range.
- After saving the code, return to the main sheet.
- Select the range of the text URLs in the Website Link column.
- Go to the Developer Tab >> Macros Option.
The Macro dialog box will open up.
- Select the macro activatinglinks.
- Click Run.
The macro returns activated hyperlinks in the Website Link column.
Read More: Excel Hyperlink with Shortcut Key
Method 3 – Using VBA InputBox Method to Activate Multiple Hyperlinks
For more flexibility in selecting which links to activate, we can use the InputBox method in VBA to create an input box in which we can select and activate multiple hyperlinks simultaneously.
Steps:
- Follow the Steps of Method 2 to open a module window.
Enter the following code:
Sub enablinglinks()
Dim w_link As Variant
Dim multiple_links As Range
Box = "Activation of Links"
Set multiple_links = Application.Selection
Set multiple_links = Application.InputBox("Select the Range of URL's", _
Box, multiple_links.Address, Type:=8)
For Each w_link In multiple_links
ActiveSheet.Hyperlinks.Add w_link, w_link.Value
Next w_link
End Sub
Here, we declared w_link as Variant and multiple_links as Range. Then we defined the title of the input box as Activation of Links which is stored in the Box, set multiple_links to the range from which we will be selecting, and assigned the InputBox method to the multiple_links.
A FOR loop is then iterates through each cell w_link of the selected range multiple_links using the HYPERLINKS function to activate each of the text URLs in this range.
- Press F5 to run the code.
- In the input box that appears, select the range of the hyperlinks $C$4:$C$12 in the Select the Range of URL’s box.
- Press OK.
The macro activates all the hyperlinks of the Website Link column.
Read More: How to Hyperlink Multiple PDF Files in Excel
Method 4 – Activating Hyperlinks by Declaring a Range
Another approach to activating multiple hyperlinks simultaneously is to declare a range for the hyperlinks in a VBA code.
Steps:
- Follow the Steps of Method 2 to open a module window.
- Enter the following code:
Sub enablinglinks1()
Dim w_link As Variant
Dim multiple_links As Range
Set multiple_links = Range("C4:C12")
For Each w_link In multiple_links
ActiveSheet.Hyperlinks.Add w_link, w_link.Value
Next w_link
End Sub
Here, we declared w_link as Variant and multiple_links as Range, then set multiple_links to the range C4:C12.
The FOR loop cycles through each cell w_link in the defined range multiple_links and uses the HYPERLINKS function to activate each of the text URLs in this range.
- Press F5 to run the code.
The macro converts the text URLs into activated hyperlinks in the Website Link column.
Read More: How to Create a Hyperlink in Excel
Download Workbook
Related Articles
- How to Fix Broken Hyperlinks in Excel
- How to Hyperlink to Cell in Excel
- How to Link Files in Excel
- How to Create Button Without Macro in Excel
<< Go Back To Hyperlink in Excel | Linking in Excel | Learn Excel
Get FREE Advanced Excel Exercises with Solutions!