Subscribe for Weekly Tutorials
BONUS: subscribe now to download our Top Tutorials Ebook!
Macro to Open a Website from Excel
How to open a website in the browser from Excel using a Macro and VBA.
This is the same as following a link or clicking a link from the worksheet except that it will be done through a Macro.
This does not open a website within Excel. Everything will still open in the browser.
The Macro
Here is the full macro that you need:
Sub Go_to_Website()
Dim ie As Object
Set ie = CreateObject("INTERNETEXPLORER.APPLICATION")
ie.NAVIGATE "http://www.google.com"
ie.Visible = True
While ie.busy
DoEvents
Wend
End Sub
This is a simple macro and it will open the website into Internet Explorer by default.
To use the macro, change http://www.google.com to whatever website you want the user to visit.
You can also replace this with a variable that holds the website url in order to make this a bit more versatile. In that case, you would just replace "http://www.google.com" with the desired variable name and without the double quotation marks around the variable name.
This is a fairly simple macro and you should not need to change anything other than what I just mentioned.
If you don't know how to put this macro into Excel, you can read this tutorial here: Install a Macro into Excel
Make sure to download the sample file attached to this tutorial so you can get the macro ready to go in Excel.
Question? Ask it in our Excel Forum
Macro: This free excel macro allows you to open any program on your computer from excel. You...
: Connect and login to a website using a macro in Excel. This allows you to open a website a...
Macro: This free macro will open the Microsoft Word program on your computer. You do need to have...
Macro: This free macro will open the Microsoft PowerPoint program on your computer. You do need t...
Macro: This free macro will open the Microsoft Outlook program on your computer. You do need...
Tutorial: Tutorial showing you how to make a user enable macros in a workbook in order to view the ...