+ Reply to Thread
Results 1 to 4 of 4

Message Box to appear only once upon activating worksheet

  1. #1
    Registered User
    Join Date
    07-02-2019
    Location
    Exeter, UK
    MS-Off Ver
    2016
    Posts
    1

    Message Box to appear only once upon activating worksheet

    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

  2. #2
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: Message Box to appear only once upon activating worksheet

    .
    One method would be to input an "X" or a "1" in a cell somewhere in your workbook. Rewrite the code so it first checks if
    the X or 1 is present. If so, don't load the MsgBox .... simply exit the sub.

    Include in the code if the X or 1 is not present to display the MsgBox.

    In the Workbook_Close event in the ThisWorkbook module ... include code that deletes the X or 1 so the macro is ready to
    run the next time.

  3. #3
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,286

    Re: Message Box to appear only once upon activating worksheet

    You would need to use a variable to flag the status as to whether activated before or not.
    Please Login or Register  to view this content.

  4. #4
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: Message Box to appear only once upon activating worksheet

    .
    nigelog :

    Your method is cleaner and easier !

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Paste to another worksheet without activating still activating it if.....
    By karmapala in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 11-16-2018, 03:29 PM
  2. Intercept click on a worksheet Tab, and conditionally *not* activating that worksheet
    By MathUKTeacher in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 11-10-2014, 10:57 PM
  3. How to delete a worksheet w/out activating it
    By ListaH in forum Excel General
    Replies: 2
    Last Post: 12-17-2008, 04:44 PM
  4. Activating a worksheet through use of a variable
    By Cads in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-07-2006, 06:50 AM
  5. [SOLVED] worksheet.activate not activating
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-12-2005, 09:05 PM
  6. Activating the last active worksheet
    By Chris M in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-27-2005, 10:05 PM
  7. [SOLVED] activating correct worksheet
    By Robert Christie in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-15-2005, 07:14 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1