ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   IF... change colour (https://www.excelbanter.com/excel-programming/293268-if-change-colour.html)

Robert Couchman[_4_]

IF... change colour
 
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
)

Frank Kabel

IF... change colour
 
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


--
Regards
Frank Kabel
Frankfurt, Germany

Robert Couchman wrote:
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
)


Robert Couchman[_4_]

IF... change colour
 
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
)

Frank Kabel

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


--
Regards
Frank Kabel
Frankfurt, Germany
"Robert Couchman" schrieb im Newsbeitrag
...
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
)



Bob Phillips[_6_]

IF... change colour
 
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)

"Robert Couchman" wrote in message
...
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
)





All times are GMT +1. The time now is 08:48 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com