|
-
August 1st, 2002, 10:14 AM
#1
Excel 2000
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.
-
August 1st, 2002, 10:21 AM
#2
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.
If you're happy and you know it......it's your meds.
-
August 1st, 2002, 11:47 AM
#3
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...
-
August 2nd, 2002, 06:09 AM
#4
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 .
-
August 4th, 2002, 05:50 AM
#5
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.
-
August 5th, 2002, 01:04 PM
#6
Excel 2000
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)
-
August 5th, 2002, 09:29 PM
#7
Cell reference must be numeric (Row, Column)
so (1, 1) is Cell A1
Cell E10 would be
(10, 5),
not (10, E).
Good luck.
-
August 6th, 2002, 02:32 AM
#8
Excel2000
You have right. It works.....
Many thanks for this
Filip
-
August 29th, 2002, 09:48 AM
#9
excel 2000
i want also to turn in red the specific sell each time the alarm appears.
Thanks
-
August 29th, 2002, 11:12 AM
#10
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
-
August 29th, 2002, 09:24 PM
#11
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.
-
August 30th, 2002, 03:02 AM
#12
excel 2000
Sorry but i have no idea what is <coditional formating>
If you please explain this ill be very greatfull
Thanks anyway
Filip
-
August 30th, 2002, 04:29 AM
#13
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 .
Today is the tomorrow that you worried about yesterday
-
August 30th, 2002, 05:38 AM
#14
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...
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.
-
August 30th, 2002, 10:07 AM
#15
excel2000
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
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|