Cell C8 and C9 in Worksheet "Google maps" has the pickup and drop-off points. The distance is calculated and shown in C18. Worksheet "Sheet 2" also has Column A with pick up points and Row 1 with the respective drop-off.
I want to write VBA code that will loop through and reference each pick and drop-off in "sheet 2" to "Google maps" then return their respective distances.
Sub Distance()
'
' Distance Macro
' To populate distance
'
' Keyboard Shortcut: Ctrl+Shift+D
'
Sheets("Google maps").Select
Range("C8").Select
ActiveCell.FormulaR1C1 = "=Sheet2!R[-6]C[-2]"
Range("C9").Select
ActiveCell.FormulaR1C1 = "=Sheet2!R[-8]C[-1]"
Sheets("Sheet2").Select
Range("B2").Select
ActiveCell.FormulaR1C1 = "='Google maps'!R[16]C[1]"
Range("B3").Select
End Sub