VBA code: jump to the next task ?

M

Michael Freitter

Hello!

I have a VBA question.

I am in the Gantt-Chart and I have a task selected
The ID from the active task is:

ActiveCell.Task.ID

I search now a simple code, that I can jump a task backwards and forwards.

for example:

ActiveCell.Task.ID is 7
<jump to the next task ID>
ActiveCell.Task.ID gives 8

Thanks for any advice.
Michael
 
J

Jan De Messemaeker

Hi,

pplication.selectcellup
application.selectcelldown

Those jump to the necxt task displayed.
If however the tasks are not in ID order (such as after a sort) the thing is
much more complex because you don't know the row of the task, you don't even
know whether the task is visible or not (filtering?) so a solutuion has to
be about as follows:

selectbeginning
for counter=1 to activeselection.tasks.count
selectrow row:=1
if activeselection.tasks(1).id=TheOldID+1 then
..... handle
end if
next

Hope this helps,


--
Jan De Messemaeker
Microsoft Project Most Valuable Professional
+32 495 300 620
For availability check:
http://users.online.be/prom-ade/Calendar.pdf
 

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