This project contains VBA macros that perform two main functionalities within an Excel workbook:
- Random Color Generation for Selected Cells
- Animated Color Rings Expanding from a Selected Cell
These features are easy to use and create an engaging visual experience in Excel.
To start, you can download the pre-configured Excel file, named Rings.xlsm, which contains all the macros ready to run. This file is a macro-enabled workbook, meaning it allows you to run the VBA code inside.
- Download the
Rings.xlsmfile from the GitHub repository. - Open the file in Excel. Ensure that macros are enabled (if not, you will get a warning, and you may need to enable macros manually).
If you'd like to view or edit the VBA code, follow these steps:
- Open Excel and the
Rings.xlsmfile. - Press
Alt + F11to open the Visual Basic for Applications (VBA) editor. - In the VBA editor window, you will see three modules (Module 1, Module 2, and Module 3). These contain the code for random color generation and the animated color rings.
There are two main functions you can run, each creating different effects on the cells in the worksheet.
To use this function:
- Select a cell or range of cells in the worksheet.
- In the VBA editor (opened with
Alt + F11), find and execute the macroChangeCellColorRandomly. You can run the macro by:- Pressing
Alt + F8, selectingChangeCellColorRandomly, and clicking "Run."
- Pressing
- The selected cells will start changing their background colors randomly over the course of a few seconds.
To use the animated color rings:
- Select a central cell in the worksheet. This will be the starting point for the rings, which will expand outward.
- In the VBA editor, first run the macro
GenerateRandomColorsto generate a list of random colors. This step must be done before running the ring animation. - After generating the colors, run the
CreateRandomColoredRingsmacro to start the animation:- Press
Alt + F8, selectCreateRandomColoredRings, and click "Run."
- Press
- You will see colored rings expanding from the selected cell, filling the surrounding cells with random colors. The animation will repeat several times for a visually appealing effect.
The code is pre-configured for a nice visual experience, but you can customize some parameters directly in the VBA code:
numColors: Controls the number of color changes for the cells in theChangeCellColorRandomlyfunction.maxRadius: Controls the maximum size of the rings in theCreateRandomColoredRingsanimation.Delays: You can adjust the delay time between color changes to make the animation faster or slower.
