M
Mark Durrenberger
Let me try again.
The code below handles a change in "Duration8" either from a user typing in
a value or when a value is typed in then a "Fill down" command is used (Fill
down uses a selection so the for each in the ActiveSelection handles this
nicely.)
The change event fires when the data is pasted into the Duration8 column.
But the calculation is done with data already in Duration8 not the pasted
numbers...
So I think the question is how do I get the code to use the values that are
on the clipboard...
Thanks, Mark
'Private Sub MSPApp_ProjectBeforeTaskChange(ByVal tsk As MSProject.Task, _
ByVal Field As PjField, _
ByVal NewVal As Variant, _
Cancel As Boolean)
'
' change in duration8
' works for either a typed change or a "fill" (selection)
'
Select Case Field
Case pjTaskDuration8
For Each T In ActiveSelection.Tasks
T.Duration = (T.Duration10 + T.Duration9 + T.Duration8) / 3
T.Estimated = False
Next T
TextDuration = NewVal ' to handle the byval/byref passing in the
next statement
NewDuration = myConvertTextDuration(TextDuration) ' looks for
day/week/minutes units
ActiveCell.Task.Duration = (ActiveCell.Task.Duration10 +
ActiveCell.Task.Duration9 + NewDuration) / 3
End Select
The code below handles a change in "Duration8" either from a user typing in
a value or when a value is typed in then a "Fill down" command is used (Fill
down uses a selection so the for each in the ActiveSelection handles this
nicely.)
The change event fires when the data is pasted into the Duration8 column.
But the calculation is done with data already in Duration8 not the pasted
numbers...
So I think the question is how do I get the code to use the values that are
on the clipboard...
Thanks, Mark
'Private Sub MSPApp_ProjectBeforeTaskChange(ByVal tsk As MSProject.Task, _
ByVal Field As PjField, _
ByVal NewVal As Variant, _
Cancel As Boolean)
'
' change in duration8
' works for either a typed change or a "fill" (selection)
'
Select Case Field
Case pjTaskDuration8
For Each T In ActiveSelection.Tasks
T.Duration = (T.Duration10 + T.Duration9 + T.Duration8) / 3
T.Estimated = False
Next T
TextDuration = NewVal ' to handle the byval/byref passing in the
next statement
NewDuration = myConvertTextDuration(TextDuration) ' looks for
day/week/minutes units
ActiveCell.Task.Duration = (ActiveCell.Task.Duration10 +
ActiveCell.Task.Duration9 + NewDuration) / 3
End Select