From: Stuart on
John, help!

I've been using your VBA code for counting the number of resources:

Sub ResCount()
Dim t As Task
For Each t In ActiveProject.Tasks
If Not t Is Nothing Then
t.Number1 = t.Assignments.Count
End If
Next t
End Sub

Which works great to count the number of resources assigned to a task.

However, I have one resource assigned to a task but with the units set to say 200%.

I want to count the maximum resource units and display them in a column. For example, in a task gannt with a resource set at 200% I want a column to display the answer as 2. Is this possible?

Thanks

Stuart





John wrote:

Re: Resource Count Field
07-Jun-07

Robert,
You're welcome and thanks for the feedback.

John

Previous Posts In This Thread:

On Wednesday, June 06, 2007 9:56 AM
Robert H wrote:

Resource Count Field
I need to display a column in the Gantt chart table that shows the
resource count for each task. Ive been trying to create a custom
field but there does not seem to be a "Count" function in the formula
builder. Searching the forums, I see that in VBA
"Task.Resources.Count" can be used. Is it possible to use this
somehow in the formula builder, or to make it a custom function as in
excel VBA?

On Wednesday, June 06, 2007 10:33 AM
John wrote:

Re: Resource Count Field
In article <1181138195.015571.52310(a)o5g2000hsb.googlegroups.com>,
Robert H <robert.hatcher(a)l-3com.com> wrote:


Robert,
Is it possible, no. However, the following simple VBA macro will do what
you want. I chose to dump the count into the spare Number1 field.

Sub ResCount()
Dim t As Task
For Each t In activeproject.Tasks
If Not t Is Nothing Then
t.Number1 = t.Assignments.count
End If
Next t
End Sub

Hope this helps.
John
Project MVP

On Wednesday, June 06, 2007 4:46 PM
Robert H wrote:

Thanks John, that worked nicely!
Thanks John, that worked nicely!

On Thursday, June 07, 2007 11:13 AM
John wrote:

Re: Resource Count Field
Robert,
You're welcome and thanks for the feedback.

John


Submitted via EggHeadCafe - Software Developer Portal of Choice
Book Review: C# 4.0 In a Nutshell [O'Reilly]
http://www.eggheadcafe.com/tutorials/aspnet/6dc05c04-c7f9-40cc-a2da-88dde2e6d891/book-review-c-40-in-a.aspx
 | 
Pages: 1
Prev: Bar Text on Gantt Chart
Next: Current Date