What are you starting now?


I recently came across this interesting question from Algola in MPUG Discussion Forum

http://www.mpug.com/forums/topic/filter-activities-that-can-start/

In other words, the solution should work for the below scenarios
Scenario 1: Unstarted tasks without any predecessors

Scenario 2: Unstarted tasks with all predecessors 100% complete

Let me demonstrate how this can be done using VBA Macros

1. Click View tab. Click Macros dropdown and select Visual Basic

image12.png?w=640

2. In the editor, double click your current project on the left panel. This will display the code editor.
3. Now, insert a procedure named ReadyToStart by selecting Insert menu, and then Procedure.

4. Inside the ReadyToStart procedure, write this code to loop through all the tasks in the current project

5. We will now use the Marked field to indicate whether the task is ready to start or not. If the current task is not yet started, set Marked to True otherwise False

6. If the current task is not yet started then check if predecessors, if any, are completed or not

7. After marking the tasks, we will now highlight these tasks by creating a filter Ready To Start

The complete code is shown below

8. Now to run this macro click View tab. Click Macros dropdown and select View Macros. Select the macro ReadyToStart and click Run button

Get alerted when tasks have no dependencies set


In my previous blog post "Highlight items after every change", you have learnt how to apply highlight the tasks after every change by using Visual Basic for Applications macro.

Best practice followed when linking tasks is (a) Don’t link summary tasks to summary task – as it complicates the scheduling logic, (b) Every other task should have at least one predecessor or successor task.

It is easy to validate the above provide your plan is small (this is quite relative again 🙂 ). In this blog post, I will walk through on how VBA macros can color tasks automatically with no dependencies set and color summary tasks with dependencies set.

In the above plan, you can notice I have violate the first rule (a) Phase 1 (task id 1) is linked to Phase 2 (task id 4), (b) Go Live (task id 7) is not linked to any other tasks

Let’s start with a pseudocode for this requirement.

1. For each task in plan do
1.1. If task is not empty and active
1.1.1. If the task is summary task
1.1.1.1. If number of dependencies is greater than zero, then mark it.
1.1.2. If the task is not summary task
1.1.2.1. If number of dependencies is zero, then mark it
2. Color the marked task

Now you need to translate each statement by using Project model object, properties and methods.

1. Click View tab. Click Macros dropdown and select Visual Basic
image12.png?w=640

2. In the editor, double click your current project on the left panel.
3. Now change the object and procedure to "Project" and "Calculate".

4. This will include a private sub-routine which will be invoked automatically after calculation!!

5. Within this sub-routine, include the below script

The above sub-routine checks if the current view is Gantt Chart. Then, it changes the text styles of marked tasks (Item:=5) to default color. Then, we loop through the task list and mark the tasks having the issues.

After closing the editor, I just retyped a task information and Project automatically colors the task that need attention in red.