ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Conditional statement (https://www.excelbanter.com/excel-programming/387227-conditional-statement.html)

anamarie30

Conditional statement
 
I need to include in this conditional statement that when a person enter in
the cell an "N/A" instead of a numerical value, the cell color remain with
interior color 8 (cell.Interior.ColorIndex = 8). But now what my macro do is
that for "N/A" value in the cell, automatically change the cell color to red
(cell.Interior.ColorIndex = 3). How can I rewrite my condition statement for
make it this true. My code is as follow:

If cell.Value 183 Then
MsgBox "Down Time Change Over Goal (Goal = 183 min)!"
cell.Interior.ColorIndex = 3
Else
cell.Interior.ColorIndex = 8
End If

anamarie30

Conditional statement
 
I already resolve the problem but for benefic of everyone else, I will share
it.

If cell.Value = "N/A" Then
cell.Interior.ColorIndex = 8
ElseIf cell.Value 183 Then
MsgBox "Down Time Change Over Goal (Goal = 183 min)!"
cell.Interior.ColorIndex = 3
ElseIf cell.Value <= 183 Then
cell.Interior.ColorIndex = 8
End If



"anamarie30" wrote:

I need to include in this conditional statement that when a person enter in
the cell an "N/A" instead of a numerical value, the cell color remain with
interior color 8 (cell.Interior.ColorIndex = 8). But now what my macro do is
that for "N/A" value in the cell, automatically change the cell color to red
(cell.Interior.ColorIndex = 3). How can I rewrite my condition statement for
make it this true. My code is as follow:

If cell.Value 183 Then
MsgBox "Down Time Change Over Goal (Goal = 183 min)!"
cell.Interior.ColorIndex = 3
Else
cell.Interior.ColorIndex = 8
End If



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

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