How do I open a website from a cell in a spreadsheet using VBA?

mrtnlagonda

New member
Local time
Yesterday, 20:58
Joined
Feb 25, 2014
Messages
1
So I have a list of websites in one column, that continues for over 600 rows. For my project, I need to go to each website to check something. I would rather not copy each link, then go to my browser, click paste, then click enter, over 600 times. I would rather have some loop where it opens the first 30 in 30 different tabs or windows automatically when I hit run. This is the code I used to open a website:

Sub VisitWebsite()

Dim ie As Object
Set ie = CreateObject("INTERNETEXPLORER.APPLICATION")

ie.NAVIGATE "google.com"
ie.Visible = True

While ie.busy
DoEvents
Wend

End Sub


But I want to replace google.com with the url text in each cell. But it just opens up internet explorer to whatever is in the quotes above. Can someone help with this? Hopefully I explained it clearly. Thank you!

EDIT: Someone helped me figure it out. This is what I'm using now:
Sub WebPage()

Dim IEapp As Object
Dim WebUrl As String
Dim i As String
i = Range("Y3")

Set IEapp = CreateObject("InternetExplorer.Application") 'Set IEapp = InternetExplorer

IEapp.Visible = True

'Opens URL in Chrome if installed, replace chrome.exe with FireFox
For Each Item In Range("Y3:Y646")
If Item.Value <> "" Then
IEapp.navigate Item.Value
Do While IEapp.busy: Loop
Application.Wait Now + TimeValue("00:00:01")

Item.Offset(0, 1).Value = MsgBox("Link Correct", vbYesNo)
End If
Next Item




End Sub
 
Last edited:

Users who are viewing this thread

Back
Top Bottom