Choropleth Map Template Brazil

Gabriel’s approach has a couple of advantages compared to Tushar’s original implementation:

  1. There is no need for organizing a color gradient table with different colors (e.g. grey shades). Simply format all shapes in black (or any color you may choose) and run the macro.
  2. Thus, it is very easy to switch the coloring from shades of grey to any other color. Simply select all shapes, assign a new fill color and run the macro.
  3. The workbook needs less cells and less calculations, has a higher performance and a smaller file size.
  4. Gabriel’s workbook uses by far less VBA code. Tushar’s code is already very lean and efficient (31 lines of code), but Gabriel’s implementation is even leaner (9 lines of code):
    Option Explicit

    Sub UpdateMap()
    Dim myCell As Range

    Application.ScreenUpdating = False
    For Each myCell In _
    Sheets(1).Shapes(myCell.Value).Fill.Transparency = _
    Application.WorksheetFunction.VLookup(myCell.Value, _
    Range("MapShapeToTransparency"), 2, False)
    Next myCell
    Application.ScreenUpdating = True

    End Sub

Download the workbook for free here:

Download Choropleth Map Brazil with transparencies (Microsoft Excel 2003, 122K)

Muito obrigado, Gabriel.

Gabriel has a blog of his own: Don’t talk about life. His blog is not fully dedicated to visualization or data analysis, but Gabriel provides a couple of posts on Microsoft Excel. The blog is in Portuguese and unfortunately my knowledge of Portuguese is limited to obrigado and desculpe. However, if you speak Portuguese, I recommend to check it out here.

If anyone out there wants to contribute to our little collection of choropleth maps with Excel here on Clearly and Simply: you are most welcome to send in your maps. You will find an email-link on the left column of this blog.

Add a Comment

Your email address will not be published. Required fields are marked *