Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default 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" wrote in message
...
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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default 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"), procedu="RunWhat", _
schedule:=True, latesttime:=Range("A4") + TimeSerial(0, 0, 30)

Application.OnTime earliesttime:=Range("A5"), procedu="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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default 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"), procedu="RunWhat", _
schedule:=True, latesttime:=Range("A4") + TimeSerial(0, 0, 30)

Application.OnTime earliesttime:=Range("A5"), procedu="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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Creating Message Box Warning

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

Application.OnTime earliesttime:=Range("A5"), procedu="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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get rid of the warning message RJ Setting up and Configuration of Excel 2 March 27th 09 05:35 PM
Fonts warning message when creating charts Tom-S Excel Discussion (Misc queries) 5 December 23rd 08 12:50 PM
Warning Message bollard Excel Worksheet Functions 6 September 12th 07 05:59 PM
warning message allan Excel Discussion (Misc queries) 2 March 5th 07 03:20 AM
Warning message Paul Excel Discussion (Misc queries) 1 March 11th 05 11:07 PM


All times are GMT +1. The time now is 10:19 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"