Julie
Project MVP
Visit http://project.mvps.org/ for the FAQs and additional
information about Microsoft Project
On 2/8/2010 1:55 PM, Marty wrote:
>
"Marty" <Ma...@discussions.microsoft.com> wrote in message
news:6AF55171-A29E-4285...@microsoft.com...
>
Sub Task_Counter()
ViewApply Name:="&Gantt Chart" 'macro must be run from the Gantt Chart view
AllTasks = 0
SubTasks = 0
y = 101
Comp = 0
Uncomp = 0
Unstarted = 0
Dim t As Task
Dim ts As Tasks
Set ts = ActiveProject.Tasks
For Each t In ts
If Not t Is Nothing Then 'avoid all blank tasks
AllTasks = AllTasks + 1 'count all tasks including summary tasks
If Not t.Summary Then 'skip summary tasks
SubTasks = SubTasks + 1 ' count subtasks tasks
y = t.PercentComplete
If y = 100 Then
Comp = Comp + 1 'count completed tasks
End If
If y < 100 And y > 0 Then
Uncomp = Uncomp + 1 'count started, but not completed tasks
End If
If y = 0 Then
Unstarted = Unstarted + 1 'count tasks that haven't started
yet
End If
End If
End If
Next t
'display the results of the counters
MsgBox "There are " + Str(AllTasks) + " total tasks, " + Str(SubTasks) + "
subtasks, " + Str(Comp) + " completed tasks, " + Str(Uncomp) + " tasks that
are partially completed, and " + Str(Unstarted) + " tasks that haven't been
started."
End Sub
"Jack Dahlgren MVP" wrote:
> .
>
"Jack Dahlgren MVP" wrote:
> .
>
Dim t As Task
For Each t In Application.ActiveSelection.Tasks
One other thing to think of, if the file is a master project with external
predecessors or successors, then there is one more nest on the "IF" statement
Dim t as task
if not t.ExternalTask=true then ...
or
if t.externaltask = false then
--
If this post was helpful, please consider rating it.
Jim Aksel, MVP
Check out my blog for more information:
http://www.msprojectblog.com