Conditional Formatting Issue

aldeb

Registered User.
Local time
Yesterday, 23:36
Joined
Dec 23, 2004
Messages
318
I have four columns in and excel spreadsheet

Transaction------ Date------ Deposit/Withdrawal------ Balance

I want to apply some conditional formatting and I am stuck:
If the Deposit/Withdrawal Column has a + Number I want all the rows to turn green and the font white.
If the Deposit/Withdrawal Column has a - Number I want all the rows to turn red and the font white.

Could someone help get me started? I am using Excel 2003
 
Adapt this sort of thing:

Code:
Sub blah()

Dim rng As Range
Dim ws As Worksheet
Dim wb As Workbook

Set wb = ThisWorkbook
Set ws = wb.Worksheets("Sheet1")

For Each rng In Range("C1", Range("C" & ws.Rows.Count).End(xlUp))
    If rng.Value < 0 Then
        With ws.Rows(rng.Row)
            .Interior.ColorIndex = 3
            .Interior.Pattern = xlSolid
            .Font.ColorIndex = 2
        End With
    End If
    
    If rng.Value > 0 Then
        With ws.Rows(rng.Row)
            .Interior.ColorIndex = 4
            .Interior.Pattern = xlSolid
            .Font.ColorIndex = 2
        End With
    End If
        
Next rng

End Sub
 
Or without using VBA, select all the rows (2 and below) you want (assume that your headings are in row 1). Then go to Format > Conditional Format, and on the left from the dropdown, choose "Formula is". In the box to the right, put in this (Be careful to include the dollar sign):

=$C2>0

Then click on the Format button in lower right, and choose green background and white font.

Then click ADD button, and choose drop down again for Formula is, and use this formula:

=$C2<0

Then click on the Format button in lower right, and choose green background and white font.


This assumes that if it is 0, then the cell color and font color will remain whatever is "normal" for that workbook.
________
TOYOTA REVO
 
Last edited:

Users who are viewing this thread

Back
Top Bottom