cell with zip only hyperlink to google maps

Cattle

New Member
Joined
Sep 30, 2020
Messages
1
Office Version
  1. 365
Platform
  1. Windows
I have a column in excel with all the zip codes in Missouri. I want to hyperlink the individual cells to that zip codes location in google maps. Each time I do an internet search I get how to create a map in excel. That is not what I want to do. Any help appreciated.
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Try this code:
VBA Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
myZipCol = 2        '<<<The column with Zip codes; 1=A, 2=B, ...
If Not Application.Intersect(Target, Columns(myZipCol)) Is Nothing Then
    ThisWorkbook.FollowHyperlink ("https://maps.google.com/?q=Zip " & Target.Value & " usa")
    Cancel = True
End If
End Sub
You need to copy it to the vba module that belongs to the worksheet:
-rightclick the tab with the name of your worksheet; chose Display code (this will open the macro editor at the right position)
-copy the given code and paste it to the empty right frame of the macro editor
-edit the line marked <<< according your situation

Then return to the worksheet and doubleclick a cell with a zip code.
It will work even if you doubleclick on a cell that contains anything, but the searched site will be an "approximate search" if it isn't a zip code

Bye
 
Upvote 0

Forum statistics

Threads
1,223,276
Messages
6,171,140
Members
452,381
Latest member
Nova88

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