All,
I've created the following Module to scrape a single value (1m % change in London house prices) from the below address:
https://www.hometrack.com/uk/insight/uk-cities-house-price-index/
The specific value is nested within the following code:
The below VBA code is my attempt at scraping. I, perhaps wrongly, feel that I am very close to capturing the value - but the code will not work.
Does anyone know where I am going wrong here? It doesn't show an error message but also doesn't output any values.
Sub HousePriceData()
Dim wb As Workbook
Dim ws As Worksheet
Dim TxtRng As Range
Dim ie As Object
Dim V As Variant
Dim myValue As Variant
Set ie = CreateObject("INTERNETEXPLORER.APPLICATION")
ie.NAVIGATE "https://www.hometrack.com/uk/insight/uk-cities-house-price-index/"
ie.Visible = False
While ie.ReadyState <> 4
DoEvents
Wend
Set wb = ActiveWorkbook
Set ws = wb.Sheets("Input")
Set TxtRng = ws.Range("C15")
Set myValue = ie.document.getElementById("cities-index-table").getElementsByTagName("tr")(7).getElementsByTagName("td")(5)
TxtRng = myValue.innerText
End Sub

getElementsByTagName("tbody")(12)- a table should only have onebodyelement. When you have a long line of code like that with multiple places where it could error, it's best to start ebugging by breaking it down into individual lines each of which access only a single element or collection. Did you meangetElementsByTagName("tr")(12)?codetbodycodeas there are tr tags incodetheadcodeand I thought it appropriate to differentiate between the two?codeSet wb = ActiveWorkbook Set ws = wb.Sheets("Input") Set TxtRng = ws.Range("C15") Set myValue = ie.document.getElementById("cities-index-table").getElementsByTagName("tr")(7).getElementsByTagName("td")(5) TxtRng = myValue.innerText End Subcode