ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Changing cell fill color as result of 'if' statement (https://www.excelbanter.com/excel-programming/275733-re-changing-cell-fill-color-result-if-statement.html)

Tom Ogilvy

Changing cell fill color as result of 'if' statement
 
if expression then
' Red
Cell.Interior.ColorIndex = 3
else
' green
cell.Interior.colorIndex = 4
End if

You expression should be something that evaluates to True or False or not
zero (true) or zero (false).

--
Regards,
Tom Ogilvy


Stuart wrote in message
...
I have an if then else statement which will give one of
two results.
One of those results I would like to change the fill color
of the cell to red and the other result I want the cell to
be green.

How can I program this if statement so that it works?

Stuart





All times are GMT +1. The time now is 09:49 AM.

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