Changing Colour of one cell

B

BIG Chris

Hi,

Firstly "Hello" to everyone who reads this ... I'm just embarking on my
first Project 2002 VBA work ... so don't be surprised if you see a few
questions from me !! Thanks in advance to anyone who helps me in the next
few weeks !!

Right down to question # 1 :

I'm importing data into a sheet from an xml file and before writing data
into a particular cell ( in this case date10 ) I check to see if the data
imported is different to what was already there. If the data is different,
then after I move the new data to the cell I then need to change the colour
of the new data ( or bold it etc ... just something that will make it stand
out ).

So I'm looping through the tasks, with :

For Each objProjTask In ActiveProject.Tasks

and therefore have access to objProjTask.Date10 and need to change it's
colour. Any idea how I go about doing this ?

Cheers,

Chris.
 
J

JackD

Date10 is not a cell. It is a field.
I'd do something more visible and easier to manipulate. For example in this
case I'd set a flag.

dim t as task
dim ts as tasks
dim myDate as date
set ts = activeproject.tasks
for each t in ts
if no t is nothing then
'read excel value into myDate
if myDate <> t.date10 then
t.flag1= true
t.Date10 = myDate
end if
end if
next t

If a flag is set you can filter and sort and group the tasks. The formatting
in the cell tells you nothing. In fact the formatting is write only. You
can't read what the existing format is, you can only set it.
 
J

Jan De Messemaeker

Hi,

Just in case you still want to color...
You have to SELECT fields that you want to format.
Lookup (through the Object browser, very handy) all methods re selection and
select what suits you best
Then use the Application.FONT method, it cts on the selected cells.
HTH
 
B

BIG Chris

Just like to say a big thankyou to "JackD" and "Jan De Messemaeker" for your
help .. I used a combination of what you both suggested and it now works like
a treat !!

Thanks again !!

Chris.
 

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