Same Event Code but an improved question (I think)

  • Thread starter Mark Durrenberger
  • Start date
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
 

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