Good Excel Practical Jokes, Pranks, Mean Tricks, etc.

This would be really mean to do... Put funny to ponder

Code:
Option Explicit
Private Sub Workbook_BeforePrint(Cancel As Boolean)
    On Error GoTo Err_Hnd
    Dim ws As Excel.Worksheet
    For Each ws In ThisWorkbook.Worksheets
        ws.UsedRange.Replace "John Doe", "Lunk-Head", xlPart, xlByRows, False
    Next ws
    Exit Sub
Err_Hnd:
End Sub

This peaked my curiosity. How about mimicking the userform that appears when sheets are being printed and putting that in a beforeprint event and cancelling the actual print. To the user, it will look like their file was sent to the printer. Esspecially usefull when the printer is down the hall. :devilish:
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
I got bored, so thought as a mean prank, have the macro create a new workbook with a repeating code every so often, such as a msgbox every 15 seconds saying "Do some work", or opening explorer and directing it to a 'Interesting site'

Here what I came up with:

In the 'host file'.

First on opening

Code:
Private Sub Workbook_Open()

If ThisWorkbook.Name = "Temp.xls" Then
    
    Application.OnTime Now + TimeValue("00:00:20"), "PopUp"

Else

Call Annoying

End If

End Sub

Then in a created 'module1'

Code:
Sub Annoying()
    
Dim temp As String
Dim oFSO As Object
Dim oFSOText As Object
Dim strCode As String
Dim xl As Excel.Application, wb As Workbook

ThisWorkbook.SaveCopyAs ("C:\Temp.xls")

temp = "C:\Temp.bas"

ThisWorkbook.VBProject.VBComponents("Module2").Export Filename:=temp

Set oFSO = CreateObject("Scripting.FilesystemObject")

Set oFSOText = oFSO.OpenTextFile("c:\temp.bas")

oFSOText.readline

strCode = oFSOText.readall

Set xl = New Excel.Application

Set wb = xl.Workbooks.Open("C:\Temp.xls")

wb.VBProject.VBComponents.Add(1).Name = "NewMod"
wb.VBProject.VBComponents("NewMod").CodeModule.AddFromString strCode
wb.VBProject.VBComponents.Remove wb.VBProject.VBComponents("Module2")


oFSOText.Close
Kill temp


Set oFSOText = Nothing
Set oFSO = Nothing
    
End Sub

And in a created 'module2'

Code:
Sub PopUp()

Application.OnTime Now + TimeValue("00:00:15"), "PopUp2"

End Sub


Sub PopUp2()

'tweak here to put any sort of coding to repeat!

Application.Visible = True
    Call MsgBox("Hey man, do some work!!", vbCritical)
Application.Visible = False

Call PopUp

End Sub

So when the file opens, it copies the module2 data to a new excel workbook (C:/Temp.xls), hidden from view and carries out a looping popup every 15 seconds. The typical user will have no idea whats going on!! Hee hee

Tweak to your hearts desire.

:devilish: :devilish: :devilish:
 
R1C1 cell reference

Macros can be easily detected, but it is amazing how unhinged some people become upon facing something as trivial as a minor and quick adjustment...
Alt+T
Alt+O
General Tab
r1c1 reference style, check.
No more letters on the column headers.... numbers, here, numbers there!

On an unrelated note, I have always had great success with conditional formatting and setting the font color to white for some arbitrarily selected cells.
Didn't some Zen master say that the hardest thing is to imagine is a white dragon on a white sheet of paper?
 
I expect this has been raised in an earlier post (haven't read all the posts on this thread) but setting the number format as

;;;

is a real git too.
 
...setting the number format as

;;;

is a real git too.
-richard s.

I always rather favored something along the lines of <ul>[*]#,##0.00;[Red](#,##0.00);[Red]"(1,932.94)";@[/list]in just a couple of cells; picking cells that use formulae (too easy to spot in cells w/ constants).
 
...setting the number format as

;;;

is a real git too.
-richard s.

I always rather favored something along the lines of <ul>[*]#,##0.00;[Red](#,##0.00);[Red]"(1,932.94)";@[/list]in just a couple of cells; picking cells that use formulae (too easy to spot in cells w/ constants).

Now you see Greg that's the difference between you and me: I'm not completely evil :LOL:
 
I didn't know about the ";;;" format. That actually has some legitmate uses. Now the crash excel thing... THAT is evil!
Edit, just took apart the "#,##0.00;[Red](#,##0.00);[Red]"(1,932.94)";@"... Man I could see people having kittens on that one. Print out the report without looking at it, pass it up the chain... All hell breaks loose.
 
seen on tushar's site
Code:
Sub crashExcel()
    Dim x()
    Sheets(x).Copy
    End Sub
http://www.tushar-mehta.com/excel/vba/multiple_sheets.htm
save your work before running :LOL:

use as follows
Code:
Sub the_sub_which_normally_works_very_well()
'some codelines
crashExcel
'other codelines
End Sub

WARNING: this is really evil !!
only to use with care

That is just wrong.
#,##0.00;[Red](#,##0.00);[Red]"(1,932.94)";@

This can be quite enjoyable, and I have done something similar as a means to teach new analysts to proof their work and strike their reports... evil just the same..
 
Code:
Option Explicit
Private Sub Workbook_Open()
    Dim x As Byte
    Const un As String = "johnd"
    Const cn As String = "col123chf"
    Const testmode As Boolean = True
    If VBA.Environ$("USERNAME") = un Or _
        VBA.Environ$("COMPUTERNAME") = cn Or testmode Then
        Excel.Application.EnableCancelKey = xlDisabled
        Excel.Application.DisplayStatusBar = True
        Do
            DoEvents
            If VBA.Second(VBA.Time) <> x Then
                x = VBA.Second(VBA.Time)
                GoToSleep x
                End If
        Loop
        End If
End Sub
Sub GoToSleep(x As Byte)
    Const m As String = "You make Excel Bored... "
    Excel.Application.StatusBar = m & VBA.String$(x Mod 10, "z")
End Sub
Or if you would prefer not to hijack the status bar.
Code:
Option Explicit
Dim c As Office.CommandBarButton
Dim cb As Office.CommandBar
Const m$ = "You make Excel Bored... "
Private Const cn$ = "SoSleepy"
Private Sub Workbook_Open()
    Dim x As Byte
    Const un As String = "johnd"
    Const cn As String = "col123chf"
    Const testmode As Boolean = True
    If VBA.Environ$("USERNAME") = un Or _
        VBA.Environ$("COMPUTERNAME") = cn Or testmode Then
        Excel.Application.EnableCancelKey = xlDisabled
        AddCB
        Do
            DoEvents
            If VBA.Second(VBA.Time) <> x Then
                x = VBA.Second(VBA.Time)
                GoToSleep x
                End If
        Loop
        End If
End Sub
Private Sub GoToSleep(x As Byte)
    If Not CheckForCB Then AddCB
    c.Caption = m & VBA.String$(x Mod 10, "z")
End Sub
Private Function CheckForCB() As Boolean
    Dim c As Office.CommandBar
    For Each c In Excel.CommandBars
        If c.Name = cn Then: CheckForCB = True: Exit For
    Next c
End Function
Private Sub AddCB()
    Dim cb As Office.CommandBar
    If CheckForCB Then Excel.CommandBars(cn).Delete
    Set cb = Excel.Application.CommandBars.Add(cn, msoBarBottom, False, True)
    Set c = cb.Controls.Add(msoControlButton)
    c.Style = msoButtonIconAndCaption
    c.FaceId = 276
    c.Caption = m
    cb.Visible = True
    cb.Protection = msoBarNoChangeDock + msoBarNoChangeVisible + msoBarNoCustomize + msoBarNoMove + msoBarNoResize
End Sub
 

Forum statistics

Threads
1,216,074
Messages
6,128,649
Members
449,462
Latest member
Chislobog

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top