Results 1 to 4 of 4
  1. #1
    3 Star Lounger
    Join Date
    Jul 2002
    Location
    Ankeny, Iowa, USA
    Posts
    344
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Conditional Formatting (Excel 2002)

    Hi,
    I'd like to use the conditional formatting function to highlight certain cells... for example:
    If cell T2 is greater than zero, then highlight cell L2 with the color green. I'm thinking I'm going to have to write a macro??? Thought I'd take a stab at the conditional format function first... I don't think it will work. Any ideas?
    Thanks!
    Lana

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Conditional Formatting (Excel 2002)

    Select cell L2 (the cell you want to color).
    Select Format | Conditional Formatting...
    Select Formula Is from the first dropdown.
    Enter =T2>0 in the box next to it (see note below)
    Click Format...
    Specify the formatting you want.
    Click OK (twice).

    Note: Excel considers text values to be larger than any number, including 0, so if you enter a text value in T2, L2 will be highlighted too. If you want to hightlight L2 only if T2 contains a number value greater than 0, use the formula

    =AND(ISNUMBER(T2),T2>0)

  3. #3
    3 Star Lounger
    Join Date
    Jul 2002
    Location
    Ankeny, Iowa, USA
    Posts
    344
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Re: Conditional Formatting (Excel 2002)

    I was so thinking that it wouldn't work so I went ahead and wrote a macro... I should have waited. This is much easier, plus the user of the worksheet won't have to press a button to run the macro. Thanks Hans... and thanks for teaching me how to write macros too!!!!
    Lana

  4. #4
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Conditional Formatting (Excel 2002)

    If you like doing things the hard way <img src=/S/grin.gif border=0 alt=grin width=15 height=15>, then you could have done it with a macro without the user having to press a button. You would put the macro into the worksheet change event routine in the module behind the worksheet. The macro would have to check to see if the cell that was changed was T2 by checking the range parameter that is passed to the worksheet change routine contains cell T2 before checking to see if T2>0, like this:

    [code]
    If Not Intesect(Activesheet.Range("T2"), Target) Is Nothing Then
    'check if T2 > 0 here
    End If

    However, conditional formatting is much easier and much more efficient.
    Legare Coleman

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •