Click to See Complete Forum and Search --> : excel 2000


F.Kourantis
August 1st, 2002, 10:14 AM
Hi ,
i need some help in Microsoft Excel 2000
I want to write a date in one cell and if its possible a month before this day come, Excel somehow to give a warning.
I mean this:
in one cell i have this date: 01/12/2002 and i want at 01/11/2002 to take a warning from Excel

Thanks anyone who can help me.

Steve R Jones
August 1st, 2002, 10:21 AM
Do you mean a warning as in you would like excel to open up all by itsself and do a reminder? If so, no can do.

pammyjleary
August 1st, 2002, 11:47 AM
If I am understanding you correctly, you want it to let you know when something will expire? You can make it turn red using "conditional formatting" with a formula...

smurfy
August 2nd, 2002, 06:09 AM
How about something like this in a VBA module:

Sub Auto_Open()

Dim AlarmdateMonth As Integer
Dim AlarmdateDay As Integer
Dim Alarmdate As Date

Sheets("Sheet1").Activate
'substitute the actual sheet name in place of "Sheet1" here

Alarmdate = Cells(1, 1)
AlarmdateMonth = Month(Cells(1, 1)) - 1
AlarmdateDay = Day(Cells(1, 1))
' substitue the correct cell reference (row,column) that contains the date in place of 1, 1 in all three variable definitions

If AlarmdateMonth = Month(Now) Then
If AlarmdateDay = Day(Now) Then
MsgBox "Today is one month prior to " & Alarmdate, vbInformation, "Alarm"
End If
End If


End Sub

This is done as Auto_Open() which means it will be checked every time the workbook is opened. There are other "on event" methods that can be used .

smurfy
August 4th, 2002, 05:50 AM
Hi Filip, got your PM and Email, been a busy weekend.

The ocde I posted is Visual Basic for Applications.
Here is a step by step to "install it" in your excel spreadsheet.

Step 1 = Open your workbook.
Step 2 = Tools>Macro>Visual Basic Editor
Step 3 = (From Microsoft Visual Basic window) Insert>Module
Step 4 = Copy and paste everything from "Sub Auto_Open()" to "End sub" in my last post into the module.
Step 5 = Substitute the name of your worksheet tab and cell reference containing your "alarm date" where I have indicated in my notes in green.
Step 6 = Save worksheet and close it.
Step 7 = Re-open it.
You will be prompted to enable macros or disable macros - Enable them.
Code will run and check dates, if no match, sheet will be ready for action.

To test the code, change your "alarm date" data to one month from today, save and close & re-open, you should get the message pop-up.

F.Kourantis
August 5th, 2002, 01:04 PM
Thanks so much for your reply
But i have stacked.
Here is the problem:

Sub Auto_Open()

Dim AlarmdateMonth As Integer
Dim AlarmdateDay As Integer
Dim Alarmdate As Date

Sheets("Sheet1").Activate
'substitute the actual sheet name in place of "Sheet1" here

Alarmdate = Cells(10, E)
AlarmdateMonth = Month(Cells(10, E)) - 1
AlarmdateDay = Day(Cells(10, E))
' substitue the correct cell reference (row,column) that contains the date in place of 1, 1 in all three variable definitions

If AlarmdateMonth = Month(Now) Then
If AlarmdateDay = Day(Now) Then
MsgBox "Today is one month prior to " & Alarmdate, vbInformation, "Alarm"
End If
End If


End Sub

somethings wrong in < Alarmdate = Cells(10,E) > .Excel says to debug and this line is yellow.
Please check
Thanks again
ilip

Alarmdate = Cells(10.E)

smurfy
August 5th, 2002, 09:29 PM
Cell reference must be numeric (Row, Column)
so (1, 1) is Cell A1
Cell E10 would be
(10, 5),
not (10, E).

Good luck.

F.Kourantis
August 6th, 2002, 02:32 AM
You have right. It works.....

Many thanks for this
Filip

F.Kourantis
August 29th, 2002, 09:48 AM
i want also to turn in red the specific sell each time the alarm appears.
Thanks

rami3
August 29th, 2002, 11:12 AM
To do that you would use conditional formating, thats all I can tell you though untill you post your problem in more detail. Conditional formating is'nt hard to figure out anyway, check your excel help files.

RB :)

smurfy
August 29th, 2002, 09:24 PM
rami3, I have merged this with Filip's old thread so everyone knows the background.

Filip, as rami3 suggests, conditional formatting will do this for you.

F.Kourantis
August 30th, 2002, 03:02 AM
Sorry but i have no idea what is <coditional formating>
If you please explain this ill be very greatfull
Thanks anyway
Filip

mhl
August 30th, 2002, 04:29 AM
Click on Conditional Formatting on the Format menu and it's fairly self-evident. For example, if you're using an accounting spreadsheet, you may want negative figures to show in red . Or in a sales report, figures which exceed target in bold .

smurfy
August 30th, 2002, 05:38 AM
Filip, please use the "Post REPLY" button, not the "New Topic" button. (I've just merged this with your old topic again).

Anyway, after mucking around with conditional formatting for 30 minutes I realise that it's probably not going to achieve what you need in conjunction with the VBA code I have given you.

So, add the following (red) lines into your code...

If AlarmdateMonth = Month(Now) Then
If AlarmdateDay = Day(Now) Then
MsgBox "Today is one month prior to " & Alarmdate, vbInformation, "Alarm"
Cells(10, 5).Select
With Selection.Interior
.ColorIndex = 3
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End If
End If

This will turn your date cell background color RED whenever the condition that raises the alarm message box is met.

F.Kourantis
August 30th, 2002, 10:07 AM
thank you very much for your repply but after this i have this error: < Compile error: End if without block if >.The complete code for your help is:

Sub Auto_Open()

Dim AlarmdateMonth As Integer
Dim AlarmdateDay As Integer
Dim Alarmdate As Date

Sheets("S1").Activate

Alarmdate = Cells(3, 3)
AlarmdateMonth = Month(Cells(3, 3)) - 1
AlarmdateDay = Day(Cells(3, 3))

If AlarmdateMonth = Month(Now) Then
If AlarmdateDay = Day(Now) Then
MsgBox "Today is one month prior to " & Alarmdate, vbInformation, "Alarm"
Cells(3, 3).Select
With Selection.Interior
.ColorIndex = 3
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic

End If
End If

Thanks again for your time
Filip

smurfy
August 30th, 2002, 07:53 PM
Ahhh whoops!
Missed a line.
:(


Sub Auto_Open()

Dim AlarmdateMonth As Integer
Dim AlarmdateDay As Integer
Dim Alarmdate As Date

Sheets("S1").Activate

Alarmdate = Cells(3, 3)
AlarmdateMonth = Month(Cells(3, 3)) - 1
AlarmdateDay = Day(Cells(3, 3))

If AlarmdateMonth = Month(Now) Then
If AlarmdateDay = Day(Now) Then
MsgBox "Today is one month prior to " & Alarmdate, vbInformation, "Alarm"
Cells(3, 3).Select
With Selection.Interior
.ColorIndex = 3
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
End If
End If

End Sub