How to repeat VBA macro with cell references changing
user6231 Published in September 19, 2018, 9:48 am
I have written the following code which scrapes webpages based on a URL (in cell B2) and then outputs a number scraped from the page in C2.
Dim ObjIE As Object
Set ObjIE = CreateObject("InternetExplorer.Application")
Application.StatusBar = "Loading, Please wait..."
Do While ObjIE.Busy
Application.Wait DateAdd("s", 1, Now)
Application.StatusBar = "Searching for value. Please wait..."
Dim dd As String
dd = ObjIE.Document.getElementsByClassName("_3xom")(0).innerText
Sheets("Facebook").Range("C2") = dd
Dim cell As Range
I have more URLs in column B. I need to find some code which will repeat the macro but change the two cell references to "B3" and "C3" respectively, and then 4, 5, 6 and so forth. I've tried all kind of loops but cant work out what might make this work!