+ Reply to Thread
Results 1 to 8 of 8

Creating Message Box Warning

  1. #1
    Mariner
    Guest

    Creating Message Box Warning

    I want to put various times into an excel spreadsheet, when these times are
    reached I need excel to display a message box with a warning and a ok button
    to acknowledge. Any ideas how to go about this.

  2. #2
    NickHK
    Guest

    Re: Creating Message Box Warning

    You can enter a date/time in a range, say A1.
    Then in the Open, SelectionChange or Change events of the worksheet, compare
    the value to the current time.

    If Range("A1").Value<Now() Then
    MsgBox "Time passed"
    End

    Is that what you mean ?

    NickHK

    "Mariner" <[email protected]> wrote in message
    news:[email protected]...
    > I want to put various times into an excel spreadsheet, when these times

    are
    > reached I need excel to display a message box with a warning and a ok

    button
    > to acknowledge. Any ideas how to go about this.




  3. #3
    skatonni via OfficeKB.com
    Guest

    Re: Creating Message Box Warning

    Try Excel's OnTime. Here is an example to start you off.

    Enter a date (with time) in cell A4 and another in A5. Run the setTimes
    macro.

    Sub setTimes()

    Application.OnTime earliesttime:=Range("A4"), procedure:="RunWhat", _
    schedule:=True, latesttime:=Range("A4") + TimeSerial(0, 0, 30)

    Application.OnTime earliesttime:=Range("A5"), procedure:="RunWhat", _
    schedule:=True, latesttime:=Range("A5") + TimeSerial(0, 0, 30)

    End Sub

    Sub RunWhat()
    MsgBox "The time is " & Now()
    End Sub


    Mariner wrote:
    >I want to put various times into an excel spreadsheet, when these times are
    >reached I need excel to display a message box with a warning and a ok button
    >to acknowledge. Any ideas how to go about this.


    --
    Message posted via OfficeKB.com
    http://www.officekb.com/Uwe/Forums.a...mming/200607/1

  4. #4
    Mariner
    Guest

    Re: Creating Message Box Warning

    Hello
    I am trying to get this to work but as I am new to this, where do I put the
    code.

    Thanks

    "skatonni via OfficeKB.com" wrote:

    > Try Excel's OnTime. Here is an example to start you off.
    >
    > Enter a date (with time) in cell A4 and another in A5. Run the setTimes
    > macro.
    >
    > Sub setTimes()
    >
    > Application.OnTime earliesttime:=Range("A4"), procedure:="RunWhat", _
    > schedule:=True, latesttime:=Range("A4") + TimeSerial(0, 0, 30)
    >
    > Application.OnTime earliesttime:=Range("A5"), procedure:="RunWhat", _
    > schedule:=True, latesttime:=Range("A5") + TimeSerial(0, 0, 30)
    >
    > End Sub
    >
    > Sub RunWhat()
    > MsgBox "The time is " & Now()
    > End Sub
    >
    >
    > Mariner wrote:
    > >I want to put various times into an excel spreadsheet, when these times are
    > >reached I need excel to display a message box with a warning and a ok button
    > >to acknowledge. Any ideas how to go about this.

    >
    > --
    > Message posted via OfficeKB.com
    > http://www.officekb.com/Uwe/Forums.a...mming/200607/1
    >


  5. #5
    skatonni via OfficeKB.com
    Guest

    Re: Creating Message Box Warning

    Alt + F11 opens the Visual Basic Editor.
    Insert menu | Module
    Paste the code.
    Click anywhere in the setTimes code.
    Run with the F5 button. (When you learn more you won't have to open up the
    editor to run the code.)

    Mariner wrote:
    >Hello
    >I am trying to get this to work but as I am new to this, where do I put the
    >code.
    >
    >Thanks
    >
    >> Try Excel's OnTime. Here is an example to start you off.
    >>

    >[quoted text clipped - 18 lines]
    >> >reached I need excel to display a message box with a warning and a ok button
    >> >to acknowledge. Any ideas how to go about this.


    --
    Message posted via http://www.officekb.com

  6. #6
    Mariner
    Guest

    Re: Creating Message Box Warning

    Thank you Skatonni this is great.
    Is it possible to display say for example "message A" when the cell A4
    procedure runs and a different message for example "message B" when cell A5
    procedure runs.

    "skatonni via OfficeKB.com" wrote:

    > Alt + F11 opens the Visual Basic Editor.
    > Insert menu | Module
    > Paste the code.
    > Click anywhere in the setTimes code.
    > Run with the F5 button. (When you learn more you won't have to open up the
    > editor to run the code.)
    >
    > Mariner wrote:
    > >Hello
    > >I am trying to get this to work but as I am new to this, where do I put the
    > >code.
    > >
    > >Thanks
    > >
    > >> Try Excel's OnTime. Here is an example to start you off.
    > >>

    > >[quoted text clipped - 18 lines]
    > >> >reached I need excel to display a message box with a warning and a ok button
    > >> >to acknowledge. Any ideas how to go about this.

    >
    > --
    > Message posted via http://www.officekb.com
    >


  7. #7
    skatonni via OfficeKB.com
    Guest

    Re: Creating Message Box Warning

    In the OnTime statement for A5 change RunWhat to anything else, perhaps
    RunWhatA5

    Application.OnTime earliesttime:=Range("A5"), procedure:="RunWhatA5", _
    schedule:=True, latesttime:=Range("A5") + TimeSerial(0, 0, 30)

    Add this third macro

    Sub RunWhatA5()
    MsgBox "message B"
    End Sub


    Mariner wrote:
    >Thank you Skatonni this is great.
    >Is it possible to display say for example "message A" when the cell A4
    >procedure runs and a different message for example "message B" when cell A5
    >procedure runs.
    >
    >> Alt + F11 opens the Visual Basic Editor.
    >> Insert menu | Module

    >[quoted text clipped - 14 lines]
    >> >> >reached I need excel to display a message box with a warning and a ok button
    >> >> >to acknowledge. Any ideas how to go about this.


    --
    Message posted via OfficeKB.com
    http://www.officekb.com/Uwe/Forums.a...mming/200607/1

  8. #8
    Mariner
    Guest

    Re: Creating Message Box Warning

    Thank You

    "skatonni via OfficeKB.com" wrote:

    > In the OnTime statement for A5 change RunWhat to anything else, perhaps
    > RunWhatA5
    >
    > Application.OnTime earliesttime:=Range("A5"), procedure:="RunWhatA5", _
    > schedule:=True, latesttime:=Range("A5") + TimeSerial(0, 0, 30)
    >
    > Add this third macro
    >
    > Sub RunWhatA5()
    > MsgBox "message B"
    > End Sub
    >
    >
    > Mariner wrote:
    > >Thank you Skatonni this is great.
    > >Is it possible to display say for example "message A" when the cell A4
    > >procedure runs and a different message for example "message B" when cell A5
    > >procedure runs.
    > >
    > >> Alt + F11 opens the Visual Basic Editor.
    > >> Insert menu | Module

    > >[quoted text clipped - 14 lines]
    > >> >> >reached I need excel to display a message box with a warning and a ok button
    > >> >> >to acknowledge. Any ideas how to go about this.

    >
    > --
    > Message posted via OfficeKB.com
    > http://www.officekb.com/Uwe/Forums.a...mming/200607/1
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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