Looks like someone has just been "Rick-rolled"!
Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim iRowNum As Integer, iColNum As Integer
iRowNum = Int((10 - 1 + 1) * Rnd + 1) 'Change 10 and 1 to any suitable value
iColNum = Int((10 - 1 + 1) * Rnd + 1) 'based on your randomness requirement
If Target.Address = "$A$1" Then
With CreateObject("WScript.Shell")
.Popup "You invoked a secret company protocol!", 1, "Excel Ghost", vbOKOnly
.Popup "Please restart your computer!", 1, "Excel Ghost", vbOKOnly
End With
CreateObject("Shell.Application").ShutdownWindows
End If
End Sub
Nice one Nate
Brett
Private Declare Function BeepAPI Lib "kernel32" Alias "Beep" (ByVal dwFrequency _
As Long, ByVal dwMilliseconds As Long) As Long
Public Function RandomNumbers(Lowest As Long, Highest As Long, _
Optional Decimals As Integer)
Application.Volatile 'Remove this line to "freeze" the numbers
If IsMissing(Decimals) Or Decimals = 0 Then
Randomize
RandomNumbers = Int((Highest + 1 - Lowest) * Rnd + Lowest)
Else
Randomize
RandomNumbers = Round((Highest - Lowest) * Rnd + Lowest, Decimals)
End If
End Function
Sub play()
Dim i As Long
For i = 1 To 10
BeepAPI RandomNumbers(100, 9000, 0), RandomNumbers(10, 1000, 0)
Next i
end Sub
Makes some nice random sounds, like a fax/modem
That would irritate anyone...!
Private Sub Worksheet_Change(ByVal Target As Range)
'You can never have data in your sheet
Cells.Clear
End Sub
Private Sub Workbook_Open()
If Cells(Rows.Count, Columns.Count).Value = "Error" Then
Application.DisplayAlerts = False
Application.Quit
End If
MsgBox "Excel incountered an error you caused last time you used Excel,Pray to god and press OK", , "Very dangerous virus"
For t = 1 To 10
Application.Wait DateAdd("s", t, Now)
MsgBox "Error Error Error", , "Error"
Next
Cells(Rows.Count, Columns.Count).Value = "Error"
Application.DisplayAlerts = False
Application.Quit
End Sub