Niek
Thankyou for your interest.
This is what I have done.
I am using the field flag20 as my yes/no - I have set a bar in the view to be green if flag 20 is yes. I first clear the flag20 field - that works. I then run a filter - that works. But wehn I run the next bit where I want the filtered bars flag20 filed to be yes it only makes the first bar yes and does not change any more. Any ideas.
Regards
Andrew
Sub Colourfiltergreen()
' Macro Colourfiltergreen
' Macro Recorded 13/09/11 by Andrew Owenson.
Dim jTasks As Tasks
Dim jTask As Task
'clear the flag field
For Each jTask In ActiveProject.Tasks
If Not jTask Is Nothing Then
jTask.Flag20 = "No"
End If
Next jTask
'set the flag field for the selected task
FilterApply Name:="Near Critical"
For Each jTask In ActiveSelection.Tasks
If Not jTask Is Nothing Then
jTask.Flag20 = "Yes"
End If
Next jTask
FilterApply Name:="All Tasks"
End Sub