Excel Prank - Sheet Jumping

Add to Favorites
Author: | Edits: don

Excel prank that selects the next worksheet in the workbook when the user navigates to another worksheet.

If the user clicks the tab for Sheet1, they will be sent to Sheet 2; this happens for each sheet in the workbook until the user clicks the last worksheet, which sends them back to the first worksheet in the workbook.


The Code

Where to Install


The Code

Private Sub Workbook_SheetActivate(ByVal Sh As Object)

Application.EnableEvents = False

'Number of sheets
SheetCount = Sheets.Count

'Make sure there is more than 1 sheet.
If Not SheetCount > 1 Then Exit Sub

'Check if the sheet selected is the last sheet.
If Sh.Index = SheetCount Then
    SheetToShow = 1
    SheetToShow = Sh.Index + 1
End If

'Navigate to the next sheet.

Application.EnableEvents = True
End Sub


Note: this goes into the ThisWorkbook code section and not a module. Look to the next section for instructions.

Where to Install


Alt + F11 (VBA window) > look to the Project window on the left side of the window (Ctrl + R if you don't already see it) > double-click ThisWorkbook > put the code into the window that opens.

You need to put the code here so that it will run for the entire workbook and not just a specific worksheet.


The only way to stop this prank is to go to the VBA window and remove the code.

Download the attached file to see this prank in Excel.

Downloadable Files: Excel File

Question? Ask it in our Excel Forum

Our Excel Courses

  • Skill Level: All Levels
  • |
  • 5 hours+

How to make a fully featured professional form in Excel that is unbreakable. This includes how to use the form to store, view, edit, and delete data from a data storage worksheet.

  • Skill Level: All Levels
  • |
  • 2 hours

Send Emails from Excel using VBA and Macros. This course starts from the Basics and builds up to more advanced examples with attaching workbooks, worksheets, PDF's, automatically sending emails, including a signature, error handling, increasing speed, and more.