counting

P

ProjectUser

Hi,

A VBA "infant/toddler" here!

I'm building a form that will do counts for me. For example, my schedule
has a customized flag column that identifies tasks as construction 75%
completed. My form consists of a text box that needs to be filled with the
number of tasks that are 75% completed with construction and numerous other
text boxes that needed to be populated with counts in a similar fashion.

Can someone get me started with code that will count tasks that are flagged
as 75% complete and the like? The count has to also exclude all milestone
activities.

thanks,
 
R

Rod Gill

Hi,

The simplest approach is to create a Filter to select the tasks you need to
count. For example a Filter to select all tasks with Flag1=Yes and not show
summary tasks and Milestone=no

Now the following code works:

dim Count as long
filterapply "75Percent"
SelectAll
count=application.ActiveSelection.Tasks.Count
selectbeginning
filterapply "All Tasks"
'Display count in form

Repeat for each statistic you need with a Filter for each. Advantage of this
way is that by fine tuning the filters you can adjust what gets counted
without having to edit any code.

Put the filters in the Global.mpt file using the Organizer (Tools menu).

--

Rod Gill
Project MVP

Project VBA Book, for details visit:
http://www.projectvbabook.com

NEW!! Web based VBA training course delivered by me. For details visit:
http://projectservertraining.com/learning/index.aspx
 

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