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.
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.
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.
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
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
>
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
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
>
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
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
>
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks