Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 6 of 6

Thread: MsgBox if day = saturday

  1. #1
    Guest

    Default

    Hi there,
    Please help me write a macro to do the following:
    I need a message box to pop up if a certain condition is met.
    The condition is if the day in a particular cell is Saturday. The particular cell contains the formula =today().

    thank you.

  2. #2
    Rest in Peace
    Join Date
    Feb 2002
    Posts
    1,582
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Try

    If Weekday(Range("A2")) = 7 Then
    MsgBox "Hello, today is Saturday", vbInformation
    End If



  3. #3
    Guest

    Default

    I have a similar query and this solution has helped but how do I get the message box to only pop up once? As it is it pops up everytime there is a key entry anywhere else on the sheet.

    Then how do I get it to move two cells to the right so the cell selector is in the right place for the next key entry?

    Hope you can help!

  4. #4
    Rest in Peace
    Join Date
    Feb 2002
    Posts
    1,582
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi

    The code would normally go in the Workbook_Open Procedure of the Workbook module. Sounds like you have it the:

    Worksheet_Calculate

  5. #5
    Guest

    Default

    It says Worksheet_SelectionChange

    What should it be on?

  6. #6
    Rest in Peace
    Join Date
    Feb 2002
    Posts
    1,582
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi

    While in Excel right click on the Excel icon top left next to "File" then select "View Code" This will take you to the Private Module of the Workbook. in here place:

    Private Sub Workbook_Open()
    If Weekday(Sheet1.Range("A2")) = 7 Then
    MsgBox "Hello, today is Saturday", vbInformation
    End If

    End Sub

    But of course this depends on when you want the code to run.



Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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