VBA (Count tasks not in bold) MS Project

bkyarbro

Board Regular
Joined
Nov 2, 2007
Messages
69
Hi,

I'm working with a MS Project file, and I want to count the tasks in the project. I have a piece of code that works for this, but it counts every line item in the file. Some of the lines are not actually tasks, but actually headers and notations where milestones were met throughout the course of the project. The only way I know to get around this is by NOT counting what is in bold (Headers and Milestones) to get a true count of actual tasks.

Here is the code I have so far.....

Sub TasksCount()
SelectAll
MsgBox ActiveSelection.Tasks.Count
End Sub

Here is a visual of what I'm trying to accomplish with line numbering......

21 -Plan Risk > Risk Management (do not count...would be in bold)
22 Identify Risks (count)
23 Perform Qualitative Risk Analysis (count)
24 Perform Quantitative Analysis (count)
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.

Forum statistics

Threads
1,224,518
Messages
6,179,256
Members
452,901
Latest member
LisaGo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top