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.

:oops:

Thanks In advance.

Kind Regards
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
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
 
Upvote 0
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....
 
Upvote 0

Forum statistics

Threads
1,214,429
Messages
6,119,433
Members
448,897
Latest member
ksjohnson1970

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top