Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Colorindex 2 not formatting
Hi, I am using an IF statement to format values in a table. Code below.
Sub Formatcells1() Dim MyCell As Range For Each MyCell In ActiveSheet.Range("B2:B20").Cells MyCell.Select If ActiveCell = 0 And ActiveCell <= 4.99 Then ActiveCell.Interior.ColorIndex = 4 Else If ActiveCell = 5 And ActiveCell <= 35 Then ActiveCell.Interior.ColorIndex = 6 Else If ActiveCell = 35 And ActiveCell <= 299.99 Then ActiveCell.Interior.ColorIndex = 45 Else If ActiveCell = 300 Then ActiveCell.Interior.ColorIndex = 3 Else If ActiveCell = "" Then ActiveCell.Interior.ColorIndex = 2 End If End If End If End If End If Next MyCell End Sub My problem is that if a cell is blank it is being coloured green. I have tried the option "" but to no avail. I am baffled as it does not seem logical. Any help would be appreciated. Thanks Davie |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Conditional formatting to change ColorIndex? | Excel Programming | |||
VBA ColorIndex Formatting | Excel Discussion (Misc queries) | |||
interior.colorindex used with conditional formatting | Excel Worksheet Functions | |||
conditional formatting and interior.colorindex | Excel Programming | |||
ColorIndex | Excel Programming |