Filter macro

T

TooN

Hello...

ive got a small problem with filtering. Ive got a macro that filters the
predecessors or successors of a task. It sets the value from Flag7 to 'YES"
and that automaticly filters it out. It works perfect but there is only one
small thing that i cant get fixed. I want to see the task that i select to
filter as well. Example:
when i select row 5 that has predecessors in row 10,13,29,45 it show the
rows 10,13,29,45 after filtering. I want to create the macro that it shows
row 5 as well. Here is the macro so far:

Sub TRACE_Predecessors()
Dim Job As Task
Dim Base As Task
For Each Job In ActiveProject.Tasks
If Not Job Is Nothing Then
Job.Flag7 = False
End If
Next Job
Set Base = ActiveSelection.Tasks(1)
Base.Flag7 = False
For Each Job In Base.PredecessorTasks
Job.Flag7 = True
FilterApply Name:="Trace", Highlight:=False
Next Job
End Sub

Can anybody help me with this??? Thanks in advance!

Gr
 
D

davegb

TooN said:
Hello...

ive got a small problem with filtering. Ive got a macro that filters the
predecessors or successors of a task. It sets the value from Flag7 to 'YES"
and that automaticly filters it out. It works perfect but there is only one
small thing that i cant get fixed. I want to see the task that i select to
filter as well. Example:
when i select row 5 that has predecessors in row 10,13,29,45 it show the
rows 10,13,29,45 after filtering. I want to create the macro that it shows
row 5 as well. Here is the macro so far:

Sub TRACE_Predecessors()
Dim Job As Task
Dim Base As Task
For Each Job In ActiveProject.Tasks
If Not Job Is Nothing Then
Job.Flag7 = False
End If
Next Job
Set Base = ActiveSelection.Tasks(1)
Base.Flag7 = False
For Each Job In Base.PredecessorTasks
Job.Flag7 = True
FilterApply Name:="Trace", Highlight:=False
Next Job
End Sub

Can anybody help me with this??? Thanks in advance!

Gr

My project VBA is very rusty, haven't done any in a while (doing a lot
of XL VBA). But I think you just need to change "Base.Flag7=False" to
"BaseFlag7=True" to fix the problem.

Hope this helps in your world.
 
T

TooN

Thanks.. solution is more easy than i thought... works perfect now!! If you
can get the selected row highlighted after filtering it its even better!!

Thanks
 

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

Similar Threads


Top