I am new to all this and am looking for some help. I have a sheet with two columns of postcodes (column 1 and 3) and looking for each row to return the distance in column 5 and time in the 6. I have managed to get the code below working but it only returns the distance and time for the first row of the sheet. The code is below and if anyone can help I would be most greatful. I need it keep running down as far as there are rows with entries in column 1. Thank you in advance.
Sub Macro2()
'
' Macro2 Macro
'
'
c01 = Cells(1, 1)
c02 = Cells(1, 3)
With New XMLHTTPRequest
.Open "Get", "https://maps.google.co.uk/maps?f=d&source=s_d&saddr=" & c01 & "&daddr=" & c02
.send
Do
DoEvents
Loop Until .readyState = 4
c03 = .responsetext
.abort
End With
If InStr(c03, "mi</span>") <> 0 Then
c03 = Mid(c03, InStr(c03, "mi</span>") - 6, 40)
If Val(c03) = 0 Then c03 = Mid(c03, 2)
If Val(c03) = 0 Then c03 = Mid(c03, 2)
c04 = Split(c03, "<")(0)
c03 = Split(Split(c03, ">")(2), "<")(0)
Cells(1, 5) = c04
Cells(1, 6) = c03
End If
End Sub
Bookmarks