![]() |
Message box when date expires
Greetings, Does any one know of a code that will prompt a message box after a certain date has been reached. Application in my mind is to have a spread sheet that keeps up with warranties and expiration dates. If I have a radio that has a one year warranty. One year after a date that is entered in, say cell "B2", prompt message box - "The warranty on Sony radio, model XGX has expired". Maybe this is a good one for you expert programmers!!! Thanks, EMoe -- EMoe ------------------------------------------------------------------------ EMoe's Profile: http://www.excelforum.com/member.php...o&userid=23183 View this thread: http://www.excelforum.com/showthread...hreadid=379971 |
Message box when date expires
I am not sure if this is what you want. copy the below code in "this workbook" at vba editor Private Sub Workbook_Open() If Worksheets("Sheet1").Range("b2").Value Now Then MsgBox "item warranty has expired" End If End Su -- anilsolipura ----------------------------------------------------------------------- anilsolipuram's Profile: http://www.excelforum.com/member.php...fo&userid=1627 View this thread: http://www.excelforum.com/showthread.php?threadid=37997 |
Message box when date expires
Ok, where in the right direction, but how do we observe more than one cell, with this code, say B2 and B3. What I tried didn't work. Private Sub Workbook_Open() If Worksheets("Sheet1").Range("b2").Value Now Then MsgBox "Sony warranty has expired" If Worksheets("Sheet1").Range("b3").Value Now Then MsgBox "Fuji warranty has expired" End If End Sub -- EMoe ------------------------------------------------------------------------ EMoe's Profile: http://www.excelforum.com/member.php...o&userid=23183 View this thread: http://www.excelforum.com/showthread...hreadid=379971 |
Message box when date expires
Never mind, I got it!!! This is the code: Private Sub Workbook_Open() If Worksheets("Sheet1").Range("b2").Value < Now Then MsgBox "Sony XGX Warranty has a EXPIRED" End If If Worksheets("Sheet1").Range("b3").Value < Now Then MsgBox "Fuji XGX Warranty has a EXPIRED" End If End Sub Thanks, EMoe -- EMoe ------------------------------------------------------------------------ EMoe's Profile: http://www.excelforum.com/member.php...o&userid=23183 View this thread: http://www.excelforum.com/showthread...hreadid=379971 |
Message box when date expires
Interesting method, but you should note.
1. For every item you need to write a conditional piece of code - not efficient 2. The location and message are hard coded for each msgbox - programme and data maintenance would be tortuous 3. For every item you get a Msgbox, each has to be dismissed before the next one appears - tedious for the user and annoying! That said if it only a couple of items then I guess it is not a problem. If the list is longer suggest you repost for a better solution. -- Cheers Nigel "EMoe" wrote in message ... Never mind, I got it!!! This is the code: Private Sub Workbook_Open() If Worksheets("Sheet1").Range("b2").Value < Now Then MsgBox "Sony XGX Warranty has a EXPIRED" End If If Worksheets("Sheet1").Range("b3").Value < Now Then MsgBox "Fuji XGX Warranty has a EXPIRED" End If End Sub Thanks, EMoe -- EMoe ------------------------------------------------------------------------ EMoe's Profile: http://www.excelforum.com/member.php...o&userid=23183 View this thread: http://www.excelforum.com/showthread...hreadid=379971 |
Message box when date expires
What about having a cell next to the item with your warning message entered
as text with the same colour as the background, white on white. Then use conditional formating to change the font to Black on Red after the expiry of the waranty. This way you can have as many items as you want. Chris "Nigel" wrote in message ... Interesting method, but you should note. 1. For every item you need to write a conditional piece of code - not efficient 2. The location and message are hard coded for each msgbox - programme and data maintenance would be tortuous 3. For every item you get a Msgbox, each has to be dismissed before the next one appears - tedious for the user and annoying! That said if it only a couple of items then I guess it is not a problem. If the list is longer suggest you repost for a better solution. -- Cheers Nigel "EMoe" wrote in message ... Never mind, I got it!!! This is the code: Private Sub Workbook_Open() If Worksheets("Sheet1").Range("b2").Value < Now Then MsgBox "Sony XGX Warranty has a EXPIRED" End If If Worksheets("Sheet1").Range("b3").Value < Now Then MsgBox "Fuji XGX Warranty has a EXPIRED" End If End Sub Thanks, EMoe -- EMoe ------------------------------------------------------------------------ EMoe's Profile: http://www.excelforum.com/member.php...o&userid=23183 View this thread: http://www.excelforum.com/showthread...hreadid=379971 |
All times are GMT +1. The time now is 11:18 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com