dating problem

grokel

New Member
Joined
May 12, 2011
Messages
2
hi guys

I'm trying to build a database for our engineers to record maintenance dates.

I have the basics done,but am stuck one piece of programing.

What I need is this: when they turn a cell green,to say they,ve finished a service,the corresponding cell,6 months later,turns red to say it needs doing again.

Or maybe 5 months-three weeks later,gives-em time to think about it?

Any help,PLEASE :confused:
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
One way to do it would be to check the dates in specific cells when the workbook is opened, compare them to today's date and color them as you wish. For example, let's assume your dates are in column A rows 1 through 10. The following code should work to turn any date 6 months or older red:

Code:
Private Sub Workbook_Open()
Dim r As Range
    Stop
 
    For Each r In Sheet1.Range("A1:A10")
        If Date - r.Value >= 180 Then
            r.Interior.Color = vbRed
        End If
    Next r
 
End Sub
 
Upvote 0
One way to do it would be to check the dates in specific cells when the workbook is opened, compare them to today's date and color them as you wish. For example, let's assume your dates are in column A rows 1 through 10. The following code should work to turn any date 6 months or older red:

Code:
Private Sub Workbook_Open()
Dim r As Range
    Stop
 
    For Each r In Sheet1.Range("A1:A10")
        If Date - r.Value >= 180 Then
            r.Interior.Color = vbRed
        End If
    Next r
End Sub

Hi doofusboy

Thanx for your reply,but I think you misunderstood.

If say cells "A - I" are dates and cells "1 - 9" are machines, and the engineers turn cell "A6" green, then cell "I9" turns red so they know that on that date it needs doing again.

grokel
 
Upvote 0

Forum statistics

Threads
1,224,534
Messages
6,179,391
Members
452,909
Latest member
VickiS

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top