Use a CommandButton Control for a Google Maps Hyperlink with Cell Data

RJSIGKITS

Board Regular
Joined
Apr 15, 2013
Messages
109
Hi Board of Genius'

Can anybody help me to achieve this, at all, please?

I currently have a Hyperlink Cell (C10) which, when clicked, takes the user externally to Google maps at the address as inputted into a number of Cells:

User Cells:
B6 = "House Name / Number"
B7 = "Street"
B8 = "Town"
B9 = "County"
B10 = "Post Code"

The Hyperlink formula I have in C10 is:
Code:
=HYPERLINK("http://maps.google.com/maps?q="&SUBSTITUTE(B6&"+"&B7&"+"&B8&"+"&B9&"+"&B10," ","+"),"VIEW ON MAP")
This works fine, but I really want this to be assigned to a CommandButton Control, but just cannot figure out how to get it to work - any help would be much appreciated.

:banghead:

Thanks In advance.

Kind Regards
 

Comfy

Well-known Member
Joined
Dec 21, 2009
Messages
3,376
Add a command button to your workbook and paste this into the code section for the button.

Code:
Private Sub CommandButton1_Click()
ActiveWorkbook.FollowHyperlink Address:="http://maps.google.com/maps?q=" & Replace(B6 & "+" & B7 & "+" & B8 & "+" & B9 & "+" & B10, " ", "+")
End Sub
 

RJSIGKITS

Board Regular
Joined
Apr 15, 2013
Messages
109
Add a command button to your workbook and paste this into the code section for the button.

Code:
Private Sub CommandButton1_Click()
ActiveWorkbook.FollowHyperlink Address:="http://maps.google.com/maps?q=" & Replace(B6 & "+" & B7 & "+" & B8 & "+" & B9 & "+" & B10, " ", "+")
End Sub

Hey, Thanks for the Reply.
I've been playing around with this and I think I had got to the same thing (Except with .co.uk in place of your .com)
This is searching for https://maps.google.co.uk/maps?q=++++ and not the address....
 

Forum statistics

Threads
1,085,691
Messages
5,385,203
Members
401,936
Latest member
stephenpoff

Some videos you may like

This Week's Hot Topics

Top