
Resources in a resource pool in date range
Steve
The following will do what you want. In your final program datFrom and datTo can be fed from may be by a userForm's text fields or inputbox.
Sub FilterOverUnderAlcRes()
Dim Res As Resource, Tsv As TimeScaleValue, Tsvs As TimeScaleValues
Dim datFrom As Date, datTo As Date
Dim flagOA As Boolean, flagUA As Boolean
datFrom = #5/9/2001#
datTo = #5/11/2001 11:59:59 PM#
For Each Res In ActiveProject.Resources
If Res Is Nothing Then GoTo continue
Set Tsvs = Res.TimeScaleData(datFrom, datTo, pjResourceTimescaledOverallocation, pjTimescaleDays, 1)
For Each Tsv In Tsvs
If Val(Tsv) > 0 Then
flagOA = True
Exit For
End If
Next
Set Tsvs = Res.TimeScaleData(datFrom, datTo, pjResourceTimescaledRemainingAvailability, pjTimescaleDays, 1)
For Each Tsv In Tsvs
If Val(Tsv) > 0 Then
flagUA = True
Exit For
End If
Next
If flagOA Or flagUA Then
Res.Flag1 = True
Else
Res.Flag1 = False
End If
continue:
Next
ViewApply Name:="Resource &Usage"
DetailStylesAdd Item:=pjOverallocation
DetailStylesAdd Item:=pjRemainingAvailability
DetailStylesAdd Item:=pjWork
FilterEdit Name:="OverOrUnderAllocated", TaskFilter:=False, Create:=True, OverwriteExisting:=True, FieldName:="Flag1", Test:="equals", Value:="yes"
FilterApply Name:="OverOrUnderAllocated"
End Sub
Regds
Venkata Krishna
Quote:
> I posted this message back in the beginning of April and got no hits on it,
> so I wanted to see if anyone had any ideas on how to do this.
> I am looking for a means of filtering the Resource Usage sheet in the
> resource pool to show the overallocated and underallocated resources whose
> overallocation occurs within a specific date range. What I want to be able
> to do is to specify a date range of 2 to 3 weeks, and have only the
> resources that are over or underallocated during those 2 to 3 weeks show up,
> along with the amount of hours that they are over or under allocated for
> that particular week. Does
> anyone have any ideas on how to do that?
> Thanks in advance,
> Steve Bering
> Bluewater