Selecting a Row

B

bgnjoe

As will be obvious in my post, I'm not an expert in VBA, but would like
to learn how to create macros - starting with ones that seem easy and
have a practical use for me. For my first macro, I thought I'd try
changing the color of a row based on a flag and created the following:

Sub ChangeColor()
Dim t As Task
For Each t In ActiveProject.Tasks
If t.EnterpriseFlag1 Then
SelectRow Row:=t, RowRelative:=False
Font Color:=pjRed
End If
Next t
End Sub

The practice schedule I'm using has 14 tasks. The 13th task has the
EnterpriseFlag1 set to "Yes". When I run this, it changes the color of
the row for Task 5 to Red. Obviously, the "t" Task variable is not
behaving as I thought it would because t=5 when the actual row = 13.
What am I doing wrong?

As a side question, I downloaded the Proj98VBE training that I found
recommended in another post here (or maybe the server group). It's
fairly helpful, but I was wondering if anyone could recommend a book
that would help a beginner?

Thanks.
Joe
 
M

Mike Glen

Hi Joe,

Try posting on the developer newsgroup as this one is closing down. Please
see FAQ Item: 24. Project Newsgroups. FAQs, companion products and other
useful Project information can be seen at this web
address:http://project.mvps.org/faqs.htm .

Mike Glen
Project MVP
 

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