Populating Cost field based on Start/Finish variance.

M

Macrofinder

I currently have many Project Schedules linked to my schedule. When a
Start/Finish field is changed in one schedule, it pushes my Start/Finish
fields and can move my entire network. I have a macro set up to copy
Start/Finish to Date1/Date4, daily.
What I am trying to capture is if my Project Start does not equal Date1,
then put a #1 in Cost2, and if Finish does not equal Date4, put a #2 in
Cost2. I would also like a message box that says, "The Start/Finish fields
have been changed," if in fact the Start/Finish dates are altered by another
schedule. I hope this makes sense.
 
J

John

Macrofinder said:
I currently have many Project Schedules linked to my schedule. When a
Start/Finish field is changed in one schedule, it pushes my Start/Finish
fields and can move my entire network. I have a macro set up to copy
Start/Finish to Date1/Date4, daily.
What I am trying to capture is if my Project Start does not equal Date1,
then put a #1 in Cost2, and if Finish does not equal Date4, put a #2 in
Cost2. I would also like a message box that says, "The Start/Finish fields
have been changed," if in fact the Start/Finish dates are altered by another
schedule. I hope this makes sense.

Macrofinder,
First of all, did you try the Compare Project Versions utility? It has
its own toolbar in Project 2003 but is an add-in for Project 2000 (not
sure about Project 2002). It was basically designed to do what you want.
It does not work with consolidated files although it doesn't sound like
that is what you have.

If for some reason the utility doesn't meet your needs, I suggest you
add a few lines of code to your existing macro to check for differences
in the dates and then write whatever data you need into the spare cost
field (although it isn't at all clear why you are using a spare cost
field instead of a spare flag, number or text field, any of which would
seem more appropriate). The following loop should get you pointed in the
right direction (remember to run this before the dates are copied):

For Each t in ActiveProject.Tasks
If Not t is Nothing Then
If t.Start <> t.Date1 Then t.Cost2 = [first value]
If t.Finish <> t.Date4 Then t.Cost2 = [other value]
End If
Next t

Hope this helps.
John
Project MVP
 
M

Macrofinder

John,

You are absolutely correct in stating that it would be easier to use a flag
or text field, however all of my flag and text fields are being used for
reporting reasons. Thank you for your assistance w/ my dilema. Take care.

John said:
Macrofinder said:
I currently have many Project Schedules linked to my schedule. When a
Start/Finish field is changed in one schedule, it pushes my Start/Finish
fields and can move my entire network. I have a macro set up to copy
Start/Finish to Date1/Date4, daily.
What I am trying to capture is if my Project Start does not equal Date1,
then put a #1 in Cost2, and if Finish does not equal Date4, put a #2 in
Cost2. I would also like a message box that says, "The Start/Finish fields
have been changed," if in fact the Start/Finish dates are altered by another
schedule. I hope this makes sense.

Macrofinder,
First of all, did you try the Compare Project Versions utility? It has
its own toolbar in Project 2003 but is an add-in for Project 2000 (not
sure about Project 2002). It was basically designed to do what you want.
It does not work with consolidated files although it doesn't sound like
that is what you have.

If for some reason the utility doesn't meet your needs, I suggest you
add a few lines of code to your existing macro to check for differences
in the dates and then write whatever data you need into the spare cost
field (although it isn't at all clear why you are using a spare cost
field instead of a spare flag, number or text field, any of which would
seem more appropriate). The following loop should get you pointed in the
right direction (remember to run this before the dates are copied):

For Each t in ActiveProject.Tasks
If Not t is Nothing Then
If t.Start <> t.Date1 Then t.Cost2 = [first value]
If t.Finish <> t.Date4 Then t.Cost2 = [other value]
End If
Next t

Hope this helps.
John
Project MVP
 
J

John

Macrofinder said:
John,

You are absolutely correct in stating that it would be easier to use a flag
or text field, however all of my flag and text fields are being used for
reporting reasons. Thank you for your assistance w/ my dilema. Take care.

Macrofinder,
You're welcome.
John
John said:
Macrofinder said:
I currently have many Project Schedules linked to my schedule. When a
Start/Finish field is changed in one schedule, it pushes my Start/Finish
fields and can move my entire network. I have a macro set up to copy
Start/Finish to Date1/Date4, daily.
What I am trying to capture is if my Project Start does not equal Date1,
then put a #1 in Cost2, and if Finish does not equal Date4, put a #2 in
Cost2. I would also like a message box that says, "The Start/Finish
fields
have been changed," if in fact the Start/Finish dates are altered by
another
schedule. I hope this makes sense.

Macrofinder,
First of all, did you try the Compare Project Versions utility? It has
its own toolbar in Project 2003 but is an add-in for Project 2000 (not
sure about Project 2002). It was basically designed to do what you want.
It does not work with consolidated files although it doesn't sound like
that is what you have.

If for some reason the utility doesn't meet your needs, I suggest you
add a few lines of code to your existing macro to check for differences
in the dates and then write whatever data you need into the spare cost
field (although it isn't at all clear why you are using a spare cost
field instead of a spare flag, number or text field, any of which would
seem more appropriate). The following loop should get you pointed in the
right direction (remember to run this before the dates are copied):

For Each t in ActiveProject.Tasks
If Not t is Nothing Then
If t.Start <> t.Date1 Then t.Cost2 = [first value]
If t.Finish <> t.Date4 Then t.Cost2 = [other value]
End If
Next t

Hope this helps.
John
Project MVP
 

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