greg said:
Is there any way to filter on tasks that only have actuals in them for a
given week?
I have tried multiple filters, and formulas but I have trouble in combining
both of the actual work and the date range of the actual work.
Thanks,
Greg
Greg,
OK, so I finished the macro before you checked back. The following code
should do what you want. It is set up for weekly periods. If you need
periods smaller than a week, modify the "Set ActW = t.Timescaledata..."
line appropriately. I also assumed you wanted to see the tasks in a task
view. If you want to see the filtered list in the Resource Usage view,
the code will need to be modified.
Sub DateRngwActuals()
Dim t As Task
Dim a As Assignment
Dim st As Date, fin As Date
Dim ActW As TimeScaleValues
Dim i As Integer
ViewApply Name:="gantt chart"
st = InputBox("Enter start date of range", "Actuals for period")
fin = InputBox("Enter finish date of range", "Actuals for period")
For Each t In activeproject.Tasks
If Not t Is Nothing Then
t.Flag1 = False
Set ActW = t.TimeScaleData(StartDate:=st, EndDate:=fin, _
Type:=pjTaskTimescaledActualWork,
timescaleunit:=pjTimescaleWeeks)
For i = 1 To ActW.count
If ActW(i).Value <> "" Then
t.Flag1 = True
Exit For
End If
Next i
End If
Next t
FilterEdit Name:="Actuals", taskfilter:=True, create:=True,
overwriteexisting:=True, _
FieldName:="flag1", test:="equals", Value:="yes", ShowInMenu:=False,
showsummarytasks:=False
FilterEdit Name:="Actuals", taskfilter:=True, operation:="and", _
newfieldname:="summary", test:="equals", Value:="no"
FilterApply Name:="Actuals"
End Sub
Hope this helps.
John
Project MVP