Practical Joke

Jeff Podgorski

Board Regular
Joined
Sep 25, 2007
Messages
148
Hello,

I would like to play a joke on a collegue, is there anyway to place a formula in a cell that displays text, something like "Hi Mike" anytime data is entered into that cell?

Thanks,
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Right click the sheet tab, select View Code and paste in

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
Target.Value = "Hello Mike"
Application.EnableEvents = True
End Sub
 
Thank you, that's great!

Right click the sheet tab, select View Code and paste in

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
Target.Value = "Hello Mike"
Application.EnableEvents = True
End Sub
 
Try

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Target.Value <> "" Then Target.Value = "Hello Mike"
Application.EnableEvents = True
End Sub
 
Suggest changing to
Code:
If Target.Cells(1, 1).Value <> "" Then Target.Cells(1, 1).Value = "Hello Mike"
otherwise if multiple cells are changed at once (eg Multiple cell Delete or Copy/Paste, Ctrl+Enter entries) the code will error with two likely consequences

1. They will see the code and likely twig to what is happening, and/or

2. Unless the user knows what they are doing in the VB editor (which they probably don't if you are playing this prank on them) they will end up with events disabled which may undesirably impact other code.
 
Give all cells a custom number format of:
"Hi Mike";"Hi Mike";"Hi Mike";"Hi Mike"
that way you wont disturb any actual data.
 
Give all cells a custom number format of:
"Hi Mike";"Hi Mike";"Hi Mike";"Hi Mike"
that way you wont disturb any actual data.

THAT one is going in my book of useless (but fun) knowledge.:rofl:
 

Forum statistics

Threads
1,224,566
Messages
6,179,555
Members
452,928
Latest member
101blockchains

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