Macro to launch a dynamic url in a cell

mhodges2021

New Member
Joined
Feb 2, 2021
Messages
1
Office Version
  1. 2016
Platform
  1. Windows
I'm very new to Macros and all things excel and have been trying to find the correct code or help for days.

I have a few urls that are all dynamically built with the hyperlink formula based on populated data on other sheets. One of my sheets contains all the of website formulas for the workbook. I am trying to build a macro that would launch the url in a certain cell on a certain sheet. I have been playing with different code that I have found from different people's answers to similar questions and have come up with this code that doesn't work:

Sub Launch_Hyperlink()
Worksheets("Websites").Range("B19").Hyperlinks(1).Follow
End Sub

The URL I'm trying to launch is in cell B19 on the sheet I have labelled "Websites"
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Hello Mhogess2021,
try in this way...
VBA Code:
Sub Launch_Hyperlink()
  
    With Worksheets("Websites")
'delete old link
        .[B19].Delete
'insert new web address
        .[B19] = "https://www.mrexcel.com/"
'create link from web address
        .Hyperlinks.Add [B19], [B19].Value, , , [B19].Value
'open browser
        .[B19].Hyperlinks(1).Follow
    End With
  
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,155
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