3 Ways to Make Your Spreadsheet Spooky

October 31, 2017

In the spirit of Halloween, I’d like to have a little bit of fun with our spreadsheets. In today’s post, we’ll go over a few ways to make your spreadsheet a little more spooky. Obviously, my choices of images / sounds are pretty innocuous, and that’s on purpose. I’m just looking to give you some ideas and hope you have as much fun with this as I had making this post. Also, please don’t give anyone a heart attack.


I DO NOT RECOMMEND USING THESE FOR ANY CRITICAL SPREADSHEET YOU USE. If you decide to do this, please use a dummy workbook with fake data. Never ever ever use a real spreadsheet for this kind of thing. It’s just too dangerous and I really don’t want to see you get in trouble over something silly like this.

Please spook responsibly.

Does this article help you? If so, please consider supporting me with a coffee ☕️

Buy Me a Coffee at ko-fi.com

Put in a Scary Background Image

You can find free images from Pixabay. I found this spooky ghost image that I’ll use to update my spreadsheet background (ok, I know it’s not spooky, but, hey, I’m trying to get that SEO).

spooky ghost

In your spreadsheet, go to View->Background.

spooky image - background

Then just select your image. You should see your image in the background:

spooky ghost in spreadsheet - large

If you want to make it even more spooky, edit the image to be barely visible by making it more transparent (you can use GIMP or paint.net to help with this).

spooky ghost transparent

To delete the background image, simply go to View -> Delete Background.

Make Data Flicker

Another way to make a spreadsheet a little more eerie is by having some random data flicker.

spooky data flickering

For this example, I simply started off by using a pre-made template by click on File -> New From Template.

Next, I opened up the VB Editor and added the following code to the ThisWorkbook module:

Option Explicit

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Source As Range)
  On Error GoTo ExitSub
  Application.EnableEvents = False

  Dim rng As Range

  Set rng = Windows(1).VisibleRange.Cells.SpecialCells(xlCellTypeConstants, xlNumbers)

  Dim totalCellsWithNumbers As Long
  totalCellsWithNumbers = rng.Cells.Count

  If (totalCellsWithNumbers = 0) Then Exit Sub

  Dim randomNumber As Long
  randomNumber = Int(totalCellsWithNumbers * Rnd)

  Dim i As Long
  Dim cell As Range

  For Each cell In rng
    If (i = randomNumber) Then
      Dim originalValue As Double
      originalValue = cell.Value

      Dim x As Long
      For x = 1 To 30 + randomNumber
        If (x Mod 12 = 0) Then
            cell.Value = cell.Value + 1
              cell.Value = originalValue
        End If

      Next x

      cell.Value = originalValue
      Exit For
    End If

    i = i + 1
  Next cell

  Application.EnableEvents = True
End Sub

If you’d like me to describe what’s happening here in detail, please let me know in the comments below.

Basically, what happens here is that we wait for the user to make a change to the workbook within one of the worksheets. Then it gets all cells that are within the visible window and filters down to just the numbers on the screen (that are not formulas). Of those visible cells with numbers in them, it will choose a random one and make it flicker by changing its value back and forth.

Again, please don’t use this for any real spreadsheet you use for your work since this VBA code messes with your data.

Add a Spooky Noise

Another way to make your spreadsheet a little more creepy is by having a sound play at random times.

For fun, let’s have an evil laugh play after the worksheet calculates and there is an error on the screen. We’ll also color the cells with errors red for an added effect. For a free MP3 download, check out SoundBible.com.

The code to play the sound will be different between Windows and Mac.

Play a Spooky Noise on a Mac

Boy, this was a lot to figure out. It’s a little bit complicated, but with the help of StackOverflow and some tweaking things a bit, I was able to come up with this code snippet (add this to whichever Worksheet module you want to use this in):

Option Explicit

Private Sub Worksheet_Calculate()
  On Error GoTo ExitSub

  Dim rng As Range
  Set rng = Windows(1).VisibleRange.Cells.SpecialCells(xlCellTypeFormulas, xlErrors)

  Dim cell As Range

  For Each cell In rng
    cell.Interior.Color = vbRed
  Next cell

  Dim myScriptResult As String
  myScriptResult = AppleScriptTask("evil_laugh.applescript", _
    "play_evil_laugh", _

End Sub

It looks at the worksheet that is being calculated (the worksheet that you put this VBA code in). It then waits to find an error that is visible on the screen and when it does, it will turn all errors red and play the evil laugh.

Be sure to create an AppleScript file like the following:

on play_evil_laugh(filePath)
  do shell script "afplay '" & filePath & "'"
end play_evil_laugh

Place this file within the directory listed in the StackOverflow answer (for me, it was /Users/joseph/Library/Application Scripts/com.microsoft.Excel).

You need to have a formula that results in an error on the worksheet that you put this code in. What I ended up doing was creating a formula that will randomly generate an error:


And then copied down.

The kind of crummy part about this solution is that you have to be able to get that file on someone’s computer in order to get this to work right. However, you could have someone come to your computer and let them run into the issue.

Play a Spooky Noise on Windows

This one was a little easier to find on the web. This is the same concept as the Mac version (find cells with errors after a sheet calculate event, then mark the error cells red and play a sound).

However, the only caveat here is that you must use a wav file (mp3 didn’t work for me).

Option Explicit

#If VBA7 And Win64 Then
  Private Declare PtrSafe Function PlaySound Lib "winmm.dll" _
    Alias "PlaySoundA" (ByVal lpszName As String, _
    ByVal hModule As LongPtr, ByVal dwFlags As LongPtr) As LongPtr
  Private Declare Function PlaySound Lib "winmm.dll" _
    Alias "PlaySoundA" (ByVal lpszName As String, _
    ByVal hModule As Long, ByVal dwFlags As Long) As Long
#End If

Const SND_SYNC = &H0
Const SND_ASYNC = &H1
Const SND_FILENAME = &H20000
Const SND_MEMORY = &H4
Const SND_PURGE = &H40

Private Sub Worksheet_Calculate()
  On Error GoTo ExitSub

  Dim rng As Range
  Set rng = Windows(1).VisibleRange.Cells.SpecialCells(xlCellTypeFormulas, xlErrors)

  Dim cell As Range

  For Each cell In rng
    cell.Interior.Color = vbRed
  Next cell

  Call PlaySound("C:\Users\joseph\Downloads\evil_laugh.wav", _
    0&, _
End Sub

This one is much easier to distribute if you can put the spooky sound on a common directory that your co-workers have access to.

Have any Spooky Ideas?

If you have any suggestions you’d like to share, please post in the comments below!

Happy Halloween!

Wow, you read the whole article! You know, people who make it this far are true learners. And clearly, you value learning. Would you like to learn more about Excel? Please consider supporting me by buying me a coffee (it takes a lot of coffee to write these articles!).

Buy Me a Coffee at ko-fi.com

Written by Joseph who loves teaching about Excel.

© 2021, Spreadsheets Made Easy