Message Box to appear only once upon activating worksheet

jollux

New Member
Joined
Dec 20, 2017
Messages
2
Hi,

I want a box to pop up when a worksheet is activated to alert the user to delete the sheet if they are not using it. So far I have:

[vba]Private Sub Worksheet_Activate()
MsgBox "Not using Census Data? Delete this tab!", vbInformation + vbOKOnly, "WARNING"
End Sub[/vba]

I'm feeling a bit stupid - but how to I get the alert to appear ONLY once, and not every time the worksheet is activated in that session?

Cheers
-Clueless
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
I'm feeling a bit stupid - but how to I get the alert to appear ONLY once, and not every time the worksheet is activated in that session?
One way is to update a cell on that sheet with the current date, and check that before showing the message, i.e.
Code:
[COLOR=#333333]Private Sub Worksheet_Activate()
[/COLOR]    If Range("Z100") <> Date Then
[COLOR=#333333]        MsgBox "Not using Census Data? Delete this tab!", vbInformation + vbOKOnly, "WARNING"
        Range("Z100") = Date
[/COLOR]    End If
[COLOR=#333333]End Sub[/COLOR]
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,598
Messages
6,120,441
Members
448,966
Latest member
DannyC96

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