Let it snow! Excel@Christmas
Originally published: 20/12/2019 10:41
Last version published: 23/03/2020 13:18
Publication number: ELQ-12952-3
View all versions & Certificate
certified

Let it snow! Excel@Christmas

Let it snow in Excel!

Description
This Excel file creates a fun snowfall for Christmas using a VBA macro.

Use: Start the snow by clicking the "Let it snow..." button. Each click runs the macro for 18 loops, so that new snow at the top reaches the bottom (row 18). You can continue the snowfall by clicking the "Let it snow..." button again or clear the snow by clicking on the "Clear snow" button. You can adjust the density of the snowfall using the spinner - if you set this to zero, no new snow is generated at the top, the existing snow falls to the ground and the snowfall ends.

Picture: The background picture is formed using narrow rows and columns. The snow is simply the * symbol formatted white.

Macro: The macro contains a double loop: one for the columns, another for the rows. For each column loop, the macro starts at the last row and copies the snowflake from the row above, if there is one. There is a special rule for the last row so that snow is added to (up to three snowflakes per cell) to create an effect of snow on the ground. Then the macro moves to the next row up and copies the snowflake from the row above, if there is one, and continues until it reaches the first row. When it gets to the first row, a random number decides if a new snowflake appears or not, based upon the snow density value set with the spinner. Then the macro moves to the second column and so on.

Have fun using!

This Best Practice includes
1 Excel file with macro

Gary Knott offers you this Best Practice for free!

download for free

Add to bookmarks

Discuss

Further information

Have fun, learn about double loops in macros (VBA), a useful approach for some automated tasks.

Some Excel macro knowledge is required if you want to analyse the VBA code.

Reviews

People using this Best Practice also downloaded


keyboard_arrow_leftkeyboard_arrow_right

Any questions on Let It Snow! Excel@Christmas?

The user community and author are here to help. Go ahead!


4.7 / 5 (3 votes)

please wait...