Resource Count Field

R

Robert H

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?
 
J

John

Robert H said:
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?

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
 
R

Robert H

Thanks John, that worked nicely!

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
 
S

Stuart Urquhart

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:

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

Re: Resource Count Field
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 Tas
For Each t In activeproject.Task
If Not t Is Nothing The
t.Number1 = t.Assignments.coun
End I
Next
End Su

Hope this helps
Joh
Project MVP

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

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/tutorial...-a2da-88dde2e6d891/book-review-c-40-in-a.aspx
 
J

Jan De Messemaeker

Hi,

Try this:

Sub MaxRes()
Dim t As Task
dim Ass as assignment
For Each t In ActiveProject.Tasks
If Not t Is Nothing Then
t.number1=0
for each Ass in t.assignments
if ass.units>t.number1 then
t.number1=ass.units
end if
next ass
End If
Next t
End Sub

Greetings,


--
Jan De Messemaeker
Microsoft Project Most Valuable Professional
+32 495 300 620
For availability check:
http://users.online.be/prom-ade/Calendar.pdf
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top