I have been getting PMs from members who were interested in the World Map Chart. One of the recent queries I received seemed like one that is generic, and a lot of members may be interested to know. I'll quote the query here, without refering to the usedname.
Hi S M C,
I saw your post of the world map (which is awesome) and am wondering how you were able to locate the countries based on longitude and latitude? I can see how you linked the bubbles to the columns of the "DataBase" tab, but I cannot see in the code where you placed the bubbles. I am trying to make a map of the USA and to make it easier for future changes, I would like to be able to add in the longitude and latitude to place the cities instead of manually placing them. I am fairly new to excel, especially vba, so I am not sure if I should even attempt this.
Thanks in advance.
Hi,
You can find the code in the macro editor. If you need to go in to the lines step by step, open the workbook in macro disabled mode. Search for the line
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
and below that add . Save and reopen the file in Macro enabled mode.
Now, when you add or remove a country, you will get in to the code. You can now hit F8 to run through each line of code.
On the longitude and latitude, for this to work, you'll need an exact fit to scale map that precisely represents the geographical landscape. You'll then need to fix the chart axes based on the position of the map (which means the starting and ending latitude and longitude of the map, since you are looking to plot a country). I on the other hand have used -180 to 180 and 90 to -90 since I was using the entire globe. So you'll have to figure that out. Plus, you may want to plot the states, so you will need the longitude and latitude of all the states within USA.
Bookmarks