Forum Discussion

KR's avatar
KR
Copper Contributor
Mar 27, 2021

How to Display Blank field using custom field

Hi   Have 2 questions with regard to Ms Project custom field usage.   1. I have a very simple question but I don't seem to be able to get it right. I am trying display a blank field on a new cus...
  • John-project's avatar
    Mar 29, 2021
    Okay I've got something that appears to work.
    1. In the Resource Usage or Resource Sheet customize the Resource Text1 field with this formula and check the option to "use formula" for task and group summary rows::
    IIf([Budget Cost]<>"",round([Number1],1) & "%","")

    2. This macro will populate the Resource Number1 field with the desired percentage data
    Sub CustomBud()
    Dim Den As Single
    Dim CFF As String
    Den = Round(ActiveProject.ProjectSummaryTask.BudgetCost)
    CFF = "iif([budget cost]<>"""",[budget cost]/" & Den & "*100,0)"
    CustomFieldSetFormula FieldID:=pjCustomResourceNumber1, Formula:=CFF
    CustomFieldPropertiesEx FieldID:=pjCustomResourceNumber1, Attribute:=pjFieldAttributeFormula, _
    summarycalc:=pjCalcFormula, GraphicalIndicators:=False, AutomaticallyRolldownToAssn:=False
    ViewApply Name:="resource sheet"
    ViewApply Name:="Resource Usage"
    End Sub

    This was challenging.
    John

Resources