Doug,
If you are working in the Resource Usage view, it would be easier to check all tasks whose
assignments comply with your criteria, and to count them each time you find one.
Here under is an exerp of a procedure whith do something like that.
For Each oTache In ActiveProject.Tasks
If Not (ActiveCell.Task Is Nothing) Then
If oTache.Summary = False Then
i = 0 'Initialisation
TotEC = 0
TotAC = 0
TotPR = 0
For Each Attrib In oTache.Assignments
EC = 0
AC = 0
PR = 0
i = i + 1
y = y + 1
If ActiveProject.Resources(Attrib.ResourceID).Group = "Equipe centrale" Then
EC = Attrib.Cost
TotEC = TotEC + EC
oTache.Assignments(i).Cost1 = EC
oTache.Cost1 = TotEC
................
"Doug" <
[email protected]> a écrit dans le message de
[email protected]...
Gerard, thanks for the quick response. But...if I am in a
resource usage view I can't ask for
the "ActiveSelection.Tasks.Count" only
the "ActiveSelection.Resources.Count" And, if no
resources are left after filtering I get the same error:
"object required" in both cases
below is my code:
'Note: Must be run from the resource usage view
'filter is created first, this part works, then applied
Sub aaaaafilter()
' Macro aafilter
FilterApply Name:="Using Resource and Date Range"
SelectSheet
MsgBox ActiveSelection.Resources.Count
'ActiveSelection.Tasks.Count
MsgBox ActiveSelection.Tasks.Count
End Sub
-----Original Message-----
Hello Doug
Try this :
Sub NbrTachesSelection()
FilterApply Name:="MyFilterOnFlag" 'You have to create the filter before...
SelectSheet
MsgBox "Number of selected tasks : " &
ActiveSelection.Tasks.Count, vbOKOnly,