Show Country Flags as Markers on X Y Chart
If you want to display the country flags as markers on X Y Scatter Chart. Snapshot below:
Steps
1 Download the country flags and save them in a folder
2 Make sure you name the flags as labels or series name
3 Run below macro
Sub custom_markers()
Dim srs As Series
Dim cht As Chart
Dim mapfolder As String
' make sure you save the maps with series name
mapfolder = "C:\Users\admin\Desktop\Flags\" ' folder in which i saved all the maps
' change chart name here
Set cht = Sheets("Sheet1").ChartObjects("Chart 1").Chart
' download the maps or shapes and save them in a folder
' I have downloaded maps from this site : http://www.free-country-flags.com/flag_pack.php?id=1
'run a loop to import flags to markes and display them on charts
For Each srs In cht.SeriesCollection
srs.MarkerStyle = xlMarkerStylePicture
srs.Format.Fill.UserPicture (mapfolder & srs.Name & ".png")
srs.Format.Line.Visible = msoFalse
srs.MarkerForegroundColorIndex = xlColorIndexNone
Next srs
End Sub
Download working File https://app.box.com/s/ulyhg0etinlsqlz88uyr
- Ashish Koul's blog
- Login or register to post comments
- 10955 reads
Recent comments
5 years 36 weeks ago
6 years 22 weeks ago
6 years 34 weeks ago
6 years 37 weeks ago
6 years 38 weeks ago
6 years 43 weeks ago
6 years 52 weeks ago
7 years 2 days ago
7 years 3 days ago
7 years 3 days ago