IF... change colour

  • Thread starter Thread starter Robert Couchman
  • Start date Start date
R

Robert Couchman

Hello all, and good morning!
im celebrating today cause its my Birthday!
anyway, could anyone please help?

i want to search through column "P" and if the value
is "TRUE" i would like to change the colour of the row,

i have the following so far

With ????? .Interior
.ColorIndex = 44
.Pattern = xlSolid
End With

please help.

Thank you,

Robert Couchman
([email protected])
 
Hi Robert
why don't you sue conditional formating?
but you may try the following

Dim rng as range
Dim cell as range
set rng = Range("P:P")
for each cell in rng
if cell.value = True then
cell.interior.colorindex=3
end if
next
 
Thank you for that,

but the code i need is to change the entire rows colour as
some of the cells including this may be hidden on a print
report!

anyone please help??

Robert Couchman
([email protected])
 
Hi Robert
for the entire row change
cell.interior.colorindex=3
to
cell.entirerow.interior.colorindex=3
 
Robert,

Here is an amendment

Dim rng as range
Dim cell as range
set rng = Range("P:P")
for each cell in rng
if cell.value = True then
cell.entirerow.interior.colorindex=3
end if
next

but you would be better to use CF as Frank suggests, otherwise the row stays
that colour even if the data changes.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 

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

Similar Threads

Thinking outside the box 2
printing problem 1
Anyone can help 5
Back to the brick wall!! 1
file name 1
thought process 3
Check a value 5
Textbox problem 11

Back
Top