IF... change colour

  • Thread starter Robert Couchman
  • 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])
 
F

Frank Kabel

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
 
R

Robert Couchman

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])
 
F

Frank Kabel

Hi Robert
for the entire row change
cell.interior.colorindex=3
to
cell.entirerow.interior.colorindex=3
 
B

Bob Phillips

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)
 
Top