Hi,
I made a VBA code that scrapes the morningstar dates of some mutual fund quotes, and places them in a column, right to the fund id.
Nevertheless, I have been trying to code the exact same operation, but instead of placing fund ID on a column, place it on a line, and expect excel to scrape the dates on the line below, just like indicated:
screenshot.PNG
Could you be so kind as to show me how can I fix my code to do so?
.xls file:
https://we.tl/BMFb7jDGAc
VBA code:
Sub DatesMSTAR()
'
Dim ie As Object
Set Rng = Range("A3:A26")
Set Row = Range(Rng.Offset(1, 0), Rng.Offset(1, 0).End(xlDown))
Set ie = CreateObject("InternetExplorer.Application")
With ie
For Each Row In Rng
.navigate "http://www.morningstar.pt/pt/funds/snapshot/snapshot.aspx?id=" & Range("A" & Row.Row).Value & ""
Do
DoEvents
Loop Until ie.readyState = READYSTATE_COMPLETE
Dim doc As HTMLDocument
Set doc = ie.document
While ie.readyState <> 4
Wend
Application.Wait (Now + TimeValue("0:00:01"))
On Error Resume Next
Range("B" & Row.Row).Value = doc.getElementsByClassName("heading")(2).innerText
Next Row
ie.Quit
End With
End Sub
Thanks so much!
Bookmarks