Conditional formatting

xtraxion

New Member
Joined
Jul 22, 2009
Messages
7
Hello

First of all, many thanks to all those people who help others with their problems!

I'm working on something which in I have to use conditional formatting. I've used VBA to have a 5th condition.

Here the VBA-code:

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
   Dim Cell As Range
    Dim Rng1 As Range
     
    On Error Resume Next
    Set Rng1 = ActiveSheet.Cells.SpecialCells(xlCellTypeFormulas, 1)
    On Error GoTo 0
    If Rng1 Is Nothing Then
        Set Rng1 = Range(Target.Address)
    Else
        Set Rng1 = Union(Range(Target.Address), Rng1)
    End If
    For Each Cell In Rng1
        Select Case Cell.Value
            Case "A"
                Cell.Interior.ColorIndex = 6
                Cell.Font.ColorIndex = 6
            Case "a"
                Cell.Interior.ColorIndex = 6
                Cell.Font.ColorIndex = 6
        End Select
    Next
End Sub

I entered the other conditions on the normal way (format -> Cond. Formatting)
If I enter an 'A' now, the cell turns yellow. That's good, but when I remove the A, it stays yellow. I want that it turns back to its normal format settings.

Can anyone help me ?

Thanks
Thomas

BTW: I'm dutch, so my english isnt that good :eek:
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Hi again,

I'm facing a new problem. I'd like to count all the green cells. Therefore, I have to use COUNTIF i suppose. (cant use programmed function with VBA because of the condit. format...)
The criteria depends on my condit format setting for green, which is:

Formula is: =IF(I9<>"";IF(I9+$O9<$P$3;FALSE;TRUE);FALSE)

So now i want to count all green cells in a random range (depends on the sheet). I'll need an array formula I think, but I cant get out with.

Here are the formulas I tried, but they didnt work..:

{=COUNTIF(I9:L9;IF(I9:L9+$O9<$P$3;TRUE;FALSE)}
{=COUNTIF(I9:L9;I9:L9+$O9<$P$3)}

Might be useful to know:

- I9:L9 contains dates (and other data)
- P3 is =TODAY()
- O9, O10 etc contains numbers (like 365, standing for 1 year or 730 = 2 years etc.)

If you need more specific information to help me solve this, I'll give you the file. Thanks alot

Thomas
 
Upvote 0
The -- coerces TRUE/FALSE to 1/0.

The formula worked when I tried it. If it's not working for you post what's in the referenced cells.
 
Upvote 0

Forum statistics

Threads
1,215,388
Messages
6,124,652
Members
449,177
Latest member
Sousanna Aristiadou

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top