Creating Mondrian Art in Excel

See how my vacation to Montreal inspired me to create Mondrian style art in Excel using VBA.

 

What is Mondrian Art?

Named after Piet Mondrian who was a Dutch artist.
He is known for being one of the pioneers of 20th century abstract art, as he changed his artistic direction from figurative painting to an increasingly abstract style, until he reached a point where his artistic vocabulary was reduced to simple geometric elements.
Read his full wikipedia here.

 

 

How Did I Discover It?

In the Montreal Museum of Fine Arts gift shop I bought this book by Antonio Lapone.

 

 

 

 

 

 

My wife said “I didn’t know that you liked Mondrian art“. I had no idea what she was referring to but thankfully she clued me in. The artist Antonio Lapone uses the Mondrian style squares and color scheme throughout the book.

 

 

Creating Mondrian Art in Excel?

 

 

 

 

 

I used VBA code to randomly create colored shapes. Here’s an example:

 

 

 

 

 

 

I’m not a vba pro but I learn a lot when I play around with it. The buttons on the right run the vba code.

 

 

Creating the VBA Code

Get my Excel file (contains macros) and follow along. Here are the steps I took to create the code:

1) Let’s get started

I used the macro recorder to see how to merge cells in VBA:

    With Selection

        .MergeCells = True

    End With

2) AddRandVariables

The macro recorder code will always select & merge the same cells. How can I randomize the location and size of the merged cells?

I found this code:   Set MyRange = Range(Cells(5, 5), Cells(10, 10)) and realized that I could replace the hard coded numbers with random variables (random location and size). 

After a lot of trial and error I ended up with this code!

 

 

 

 

 

 

 

 

 

 

 

 

3) Add Color (FINAL)

Now I added variable randcolfill to randomly assign yellow, blue or red to each merged cell.

The final macro is ‘Sub Step3_AddColor()‘. I included the macro text in sheet ‘3) Add Color (FINAL)‘.

 

5 Macros

Clicking any of the 5 objects seen below will run a macro.

  • Click the Mondrian pic to add a shape (click as many times as you’d like)
  • Click ‘Add Border Color‘ after you’ve created the desired number of shapes
  • Click ‘Unmerge Selection‘ to unmerge whatever you select with the mouse
  • Click ‘Unmerge All Cells‘ and ‘Remove Fill Color‘ to clear the canvas

 

 

 

 

 

 

 

 

 

 

More Mondrian & Modern Art

I started exploring other artists: Wassily Kandinsky, Ilya bolotowsky, Marc Chagall, Kazimir Malevich, etc. I think Wassily Kandinsky’s art is the most interesting.

This picture was from MOMA in New York City earlier this year. I didn’t know anything about Piet Mondrian or Modern art at that point except that I thought it was kind of weird. I’m still trying to learn what it’s all about. I can understand the part about freedom to explore ideas. Not all art has to adhere to strict rules.

 

 

 

 

About Me

Don’t forget that “ArtIsAnAle“. I knew it! Beer is art too! This was taken on Crescent street in Montreal. That’s Leonard Cohen in the background.

My name is Kevin Lehrbass. I’m a Data Analyst. In my world I have join types, formulas, pivots, array formulas, etc. The art world is something new that I’m trying to learn more about. I’ve been to 3 amazing museums this year (2 in New York, 1 in Montreal). Five years ago I traveled to Europe for the first time and enjoyed the art in Louvre Museum and in Vatican City.

2 Comments Creating Mondrian Art in Excel

  1. Pingback: How many unique List 1 names found in List 2? | My Spreadsheet Lab

  2. Pingback: All Combinations Using Power Query | My Spreadsheet Lab

Leave a Reply

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