Open Google Map and enter a street address retrieved from a cell

M

Michael Lanier

When I link to Google Map, I want the address posted in Sheet 5, cell
C17 to be posted in Google's address section ready to find. Is this
possible? Thanks.
 
R

rlm703

When I link to Google Map, I want the address posted in Sheet 5, cell

C17 to be posted in Google's address section ready to find. Is this

possible? Thanks.

Try this...

Sub GMapAddress()
Dim AddressInfo As String
Dim FullURL As String

AddressInfo = Sheets("Sheet5").Range("C17").Value
FullURL = "https://maps.google.com/maps?q=" & AddressInfo

ActiveWorkbook.FollowHyperlink Address:=FullURL
NewWindow = True
End Sub
 
R

rlm703

Try this...



Sub GMapAddress()

Dim AddressInfo As String

Dim FullURL As String



AddressInfo = Sheets("Sheet5").Range("C17").Value

FullURL = "https://maps.google.com/maps?q=" & AddressInfo



ActiveWorkbook.FollowHyperlink Address:=FullURL

NewWindow = True

End Sub


Add this below the FollowHyperlink code if you want to clear the contents of the cell after.

Sheets("Sheet5").Range("C17").Select
Selection.ClearContents

or this to set the value of the cell to something else:
Sheets("Sheet5").Range("C17").Value = "=A1" 'this would duplicate data in A1 to C17
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top