VBA Macro for Making a Cell a Hyperlink with URL from the Cell Beside It

danimorning

New Member
Joined
Jul 13, 2021
Messages
2
Hi! I am hoping my description of what I need makes sense. If not, I am happy to elaborate!

Let's say Column A has the title of documents and column B has the document's unique URL. I am trying to figure out if it is possible to create a macro that automatically makes the cell in column A a hyperlink with the URL from its neighboring cell in column B. So, cell A1 would be hyperlinked to the URL in B1, etc. etc. I used to just insert hyperlink, but now I have over 150 in each column, so I am hoping to find a way to automate it. Any help would be so appreciated -- thanks!
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Hello,

Try this on a copy of your work:

VBA Code:
Sub create_hyperlinks()
Dim x As Integer, text As String

For x = 1 To 329
text = Cells(x, 1).Value
ActiveSheet.Hyperlinks.Add Cells(x, 1), Address:=Cells(x, 2).Value, TextToDisplay:=text
Next x

End Sub

Change the line "For x=1 To 329" to the range in column A that contains your titles.
 
Upvote 0
Solution

Forum statistics

Threads
1,215,424
Messages
6,124,817
Members
449,190
Latest member
rscraig11

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