If Statement Comparing Today's Date to Project Date...

C

cwangosu

I'm trying to write an If statement to compare the project date to
Today's date.

This is what I want done out of the code.

If the difference between the two dates (one date being finish and the
other date being today) is greater than 5, then the column risk level
is set to medium

Thanks!
 
T

Todd Scarola

cwa....


Try the code below. Note, there is no field called 'RiskLevel' so the code
below puts the value in the Text10 field, modify to suit. Hope this helps.

-Todd

http://www.ManagementAnalytics.com

Public Sub SetRisk()
Dim TaskIndex As Task

For Each TaskIndex In ActiveProject.Tasks
If Not TaskIndex Is Nothing Then
If Now - TaskIndex.Finish > 5 Then
TaskIndex.Text10 = "Medium"
Else
TaskIndex.Text10 = "Low"
End If
End If
Next
End Sub
 
J

John

cw,
Please don't cross post. Those of us who answer check all relevant
newsgroups. See my response on your other post.

John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top