none
Macro / Copy "%Work complete" to "%Physical complete" RRS feed

  • Question

  • Hello,

    i want to know if someone has already write a Macro to automatically copy "%Work complete" to ""%Physical complete" (when EVM use %Physical complete) ? If so, is it possible to share this macro ?

    Regards,

    Sébastien

    Monday, August 3, 2015 4:56 PM

Answers

  • Hi Rolle,

    Yes, inactive tasks are shielded from this kind of updating.  Good catch - its good to see that you did this with no prior VBA experience.

    No doubt you will be expanding on this modest start.  If so, I would highly recommend Rod's book.


    Wednesday, August 5, 2015 1:18 PM

All replies

  • Sub Test()
    Dim Tsk As Task
        For Each Tsk In ActiveProject.Tasks
            If Not Tsk Is Nothing Then
                Tsk.PhysicalPercentComplete = Tsk.PercentComplete
            End If
        Next Tsk
    End Sub

    But if you always run this macro to copy % Complete, why not just change the option to % Complete for EVM calcs? Its a project level option so won't affect any other projects.


    Rod Gill
    Author of the one and only Project VBA Book
    www.project-systems.co.nz

    Monday, August 3, 2015 8:59 PM
    Moderator
  • in fact, i want to use "PhysicalPercentComplete" for EVM calculation. But MS Projet, by default, uses PercentComplete for EVM calculation. I can use "PhysicalPercentComplete" (with option) but this field is not calculated by MS Projet and need to be enter manualy...

    I had a problem using this macro. when running, the error "1101" appears (invalid argument on line Tsk.PhysicalPercentComplete = Tsk.PercentComplete).... an idea (i never write VB programm).

    Sébastien Rolle

    PMP

    Tuesday, August 4, 2015 1:21 AM
  • Try this code - same as Rod's excellent suggestion with 2 mods:

    1. Changes the basis of the change from %Complete to %WorkComplete according to your original request.

    2. Skips summary tasks, the source of your error.

    Sub Test()
    Dim Tsk As Task
        For Each Tsk In ActiveProject.Tasks
            If Not Tsk Is Nothing Then
                If Tsk.Summary = False Then
                    Tsk.PhysicalPercentComplete = Tsk.PercentWorkComplete
                End If
            End If
        Next Tsk

    End Sub

    I second Rod's concerns and wonder about your motivations for this.  In real life, Physical %Complete is not something to be inferred directly from the other two.  You use it for EVM only if you actually have systems or procedures in place to measure it directly.

    Good luck, tmb

    Tuesday, August 4, 2015 12:29 PM
  • Good catch Tom. As usual too much coding and not enough testing!

    I've been using a Klingon software release strategy: "My software isn't released, it escapes leaving testers screaming in its wake" ;-)


    Rod Gill
    Author of the one and only Project VBA Book
    www.project-systems.co.nz

    Wednesday, August 5, 2015 2:40 AM
    Moderator
  • It is working very well. Thank for the help.

    i just made a little change for the task which are not actived (it seems to not work in this case):

    Dim Tsk As Task
        For Each Tsk In ActiveProject.Tasks
            If Not Tsk Is Nothing Then
                If Tsk.Summary = False Then
                    If Tsk.Active = True Then
                        Tsk.PhysicalPercentComplete = Tsk.PercentWorkComplete
                    End If
                End If
            End If
        Next Tsk

    • Proposed as answer by Tom BoyleBPC Wednesday, August 5, 2015 1:18 PM
    Wednesday, August 5, 2015 12:09 PM
  • Hi Rolle,

    Yes, inactive tasks are shielded from this kind of updating.  Good catch - its good to see that you did this with no prior VBA experience.

    No doubt you will be expanding on this modest start.  If so, I would highly recommend Rod's book.


    Wednesday, August 5, 2015 1:18 PM