Find the shortest Google Maps distance in meters VBA function

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)


I am using the GetDistance function. It returns the distance in meters, but according to your comments, the API might return servral results, the function takes the first one.

I wanted to create a for loop that would choose the smallest distance value.

it would go something like this

Smallest_Dist= 99999999
For i=0 To ReturnedMatches.size
if (matches[i] < Smallest_Dist)
Smallest_Dist = matches[i]
Next i

I dont know how to parse the return from JSON, so I was wondering if anyone can help me.

I am asking in reference to

Excel VBA Calculate distance between two addresses or coordinates

Thank you for your help

edited question

Simply the best place to learn Excel VBA