June 21, 2024


Welcome to the core

Randomly Quit Excel – VBA

Annoying, or clever, you decide how you use it!

When Excel is opened, it sets a variable (Close_Var) equal to 30, and then chooses a random number. If that random number is less than 30, Excel immediately closes without warning. When the workbook is opened it has the chance to close instantly 30% of the time!

Private Sub Workbook_Open()
   Application.DisplayAlerts = False
   Close_Var = 30
   Rand_Num = 100 * Rnd
   If Close_Var > Rand_Num Then
   End If
End Sub
Copyright © All rights reserved. | Newsphere by AF themes.