How to reference a cell by row, column in VB in project

W

Walter L. skinner

I am writing some VB code to do some checking in my project file. I am
familiar how to reference cells in EXCEL but don't seem to be able to find
the right code to do the same in project. I want to reference a particular
location by row and column. In EXCEL for example you would use : Cells(2,6).
What do you use in project?

Thanks
 
J

Jan De Messemaeker

Hi Walter,

Generally, in Project, you don't address cells.
You address properties of Tasks/Resources.You could f.i. use

Dim Job as task
set job=activeproject.tasks(Thenumberofthetask)

then address any property of the task f.i.
Job.percentcomplete=50

Which makes your code independent of filter, sorts, inserted columns,
etcetera

If you insist to use the location of a cell in a view, you can use the
selectcell method
selectcel(row, column, rowrelative)
Then use the ActiveCell or the ActiveSelection object

But to use its contents I will still recommend to use
activeselection.tasks(1).....
Hope this helps,
 

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