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

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
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,224,823
Messages
6,181,185
Members
453,020
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