Identify row number in Gantt chart

N

NevilleT

I am using a macro to enter some standard tasks into a gantt chart. All
works well except for predecessors. I have one that is a start to start
with a 1 day lag. The code is
SetTaskField Field:="Predecessors", Value:="28SS+" & (lngQuantity * 2) &
" day", AllSelectedTasks:=True

The problem is that 28SS is the prior row. I want to know what row I am
on, put it into a variable and subtract one to get the number of the prior
row. It is not going to be row 28.

How do you read the current row into a variable in Project.?
 
J

John

JimS said:
How about activecell.task.id ?

Neville,
Jim's method should work fine if your macro is using foreground
processing (i.e. selecting rows or fields as the code runs). However you
don't specify exactly how you are adding the tasks. If your code is
running with background processing (i.e. referencing Project objects
directly as the code runs), you can usually tell which row is being
operated on by simply checking the ID property of the current task
object. For example, a macro using background processing might look
something like the following:
For Each t in ActiveProject.Tasks
If Not t is Nothing Then
[do some stuff]
TskID = t.ID
[do more stuff]
End If
Next t

Hope this helps.
John
 

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