SOLVED

Macro to auto calculate distance on google maps?

%3CLINGO-SUB%20id%3D%22lingo-sub-2371495%22%20slang%3D%22en-US%22%3EMacro%20to%20auto%20calculate%20distance%20on%20google%20maps%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2371495%22%20slang%3D%22en-US%22%3E%3CP%3EHello%20again%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20would%20like%20to%20know%20if%20it's%20possible%20to%20automatically%20bring%20the%20search%20result%20from%20google%20maps%20(or%20other%20applications%20such%20as%20bing%2C%20etc...)%20into%20a%20specific%20cell.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EFor%20example%2C%20in%20my%20sheet%201%20I%20have%20%22Paris%22%20in%20cell%20A1%20and%20%22Lyon%22%20in%20cell%20B1%2C%20and%20I%20want%20to%20show%20the%20distance%20between%20two%20cities%20in%20cell%20C1.%20Here%2C%20I%20need%20the%20driving%20distance%2C%20and%20not%20the%20lineal%20distance...%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAlso%2C%20the%20cities%20could%20change%20in%20the%20next%20sheet..%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EEvery%20help%20would%20be%20greatly%20appreciated%2C%20thank%20you%20in%20advance%20...!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2371495%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EMacros%20and%20VBA%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2371958%22%20slang%3D%22en-US%22%3ERe%3A%20Macro%20to%20auto%20calculate%20distance%20on%20google%20maps%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2371958%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1055613%22%20target%3D%22_blank%22%3E%40Soran0311%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%20will%20need%20to%20get%20an%20API%20key%20before%20you%20can%20use%20the%20code.%3C%2FP%3E%0A%3CP%3ESee%20%3CA%20href%3D%22https%3A%2F%2Fsyntaxbytetutorials.com%2Fexcel-function-to-calculate-distance-using-google-maps-api-with-vba%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3EExcel%20Function%20to%20Calculate%20Travel%20Time%20and%20Distance%20using%20Google%20Maps%20API%20with%20VBA%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

Hello again,

 

I would like to know if it's possible to automatically bring the search result from google maps (or other applications such as bing, etc...) into a specific cell.

 

For example, in my sheet 1 I have "Paris" in cell A1 and "Lyon" in cell B1, and I want to show the distance between two cities in cell C1. Here, I need the driving distance, and not the lineal distance...

 

Also, the cities could change in the next sheet..

 

Every help would be greatly appreciated, thank you in advance ...!

1 Reply
best response confirmed by Soran0311 (Occasional Contributor)
Solution

@Soran0311 

You will need to get an API key before you can use the code.

See Excel Function to Calculate Travel Time and Distance using Google Maps API with VBA