I am a huge fan of the Matrix movie series. It an amazing piece of work of its time and one of my favorites science fiction movie series.

If you have seen Matrix, there is no way you wouldn’t remember the falling code sequence.

I thought of creating this in Excel, but someone beat me to it. It has already been created and is available here.

Nitin Mehta, who created this, used a couple of Excel functions, conditional formatting, and a scroll bar to create this effect.

I have modified it to remove the scroll bar and have used a VBA code instead. Now you can simply click on the play button and the numbers would start falling by itself. Something as shown below:

##### Matrix Falling Numbers Effect in Excel

Here are the steps to create the matrix falling numbers effect in excel:

- In the first row in the range A1:AP1, enter random numbers between 0 to 9. You can either manually enter these numbers of use the RANDBETWEEN function. Remember to convert these numbers into values.
- Reduce the column width so that it is visible in a single screen.

- Copy and paste the below code in a module in VBA
`#If VBA7 Then Public Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) 'For 64 Bit Systems #Else Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) 'For 32 Bit Systems #End If Sub MatrixNumberRain() i = 1 Do While i <= 40 DoEvents Range("AR1").Value = i i = i + 1 Sleep 50 Loop End Sub`

This above code would enter the number from 1 to 4o in cell AR1. The code Sleep 50 would delay the entering of numbers by 50 milliseconds. If you run this code, you would be able to see the value in AR1 go from 1 to 40.

Now we need to specify three conditional formatting rules to give color to these numbers.

**Conditional Formatting Rule #1**

- Select the range A2:AP32, go to Home –> Conditional Formatting –> New Rule

- In the New Formatting Rule dialogue box, click on ‘Use a formula to determine which cells to format’ and enter the following formula:

=MOD($AR$1,15)=MOD(ROW()+A$1,15)

- Click on format button and set the font color to white

- Click OK

**Conditional Formatting Rule #2**

- With the range A2:AP32 selected, go to Home –> Conditional Formatting –> Manage Rule
- In the Conditional Formatting Rules Manager dialogue box, click on New Rule
- In the New Formatting Rule dialogue box, click on ‘Use a formula to determine which cells to format’ and enter the following formula:

=MOD($AR$1,15)=MOD(ROW()+A$1+1,15) - Click on format button and set the font color to light green
- Click OK

**Conditional Formatting Rule #3**

- With the range A2:AP32 selected, go to Home –> Conditional Formatting –> Manage Rule
- In the Conditional Formatting Rules Manager dialogue box, click on New Rule
- In the New Formatting Rule dialogue box, click on ‘Use a formula to determine which cells to format’ and enter the following formula:

=OR(MOD($AR$1,15)=MOD(ROW()+A$1+2,15),MOD($AR$1,15)=MOD(ROW()+A$1+3,15), MOD($AR$1,15)=MOD(ROW()+A$1+4,15),MOD($AR$1,15)=MOD(ROW()+A$1+5,15)) - Click on format button and set the font color to light green.
- Click OK.

Based on the row number and value in the first row, conditional formatting would color the text green, light green or white.

Now select the entire range of cells (A1:AP32) and make the background black.

As a final step, insert a shape/button and assign this macro to that shape/button.

*Note**:* Since this has a VBA code in it, save the file with .xls or .xlsm extension.

That’s it! Now get yourself a cup of coffee, stand in the shade, and enjoy the Matrix falling numbers digital rain 🙂

**You May Also Like the Following Excel Tutorials:**

- Useful Excel VBA Macro Examples (Ready-to-use).
- How to Sort Data in Excel using VBA (A Step-by-Step Guide).
- How to Select Every Third Row in Excel (or select every Nth Row).
- How to Use Excel VBA InStr Function (with practical EXAMPLES).

This is great! I wonder if there is a way to have the Shape act as a Start/ Stop button?

Got it:

Public iMatrix As Boolean

#If VBA7 Then

...

`Sub MatrixNumberRain()`

If iMatrix = False Then

iMatrix = True

i = 1

Do While iMatrix = True

DoEvents

Range("AW1").Value = i

i = i + 1

Sleep 100

Loop

Else

iMatrix = False

End If

End Sub

Hi Sumit, glad to see you found this app useful and good work with the macro!

Nice site, keep up the good work!

Best wishes,

Nitin

If I could think of any justification for using this in my work, I would totally do it.

I wish the same Richard.. Chart Animations can be created in the same way, but even that has a limited use (if any) in day to day work.