Consulting

Results 1 to 5 of 5

Thread: Trouble with conditional format for entire column

  1. #1

    Trouble with conditional format for entire column

    I'm unable to enter a conditional format as part of a Macro. Row H contains multiple data. The desired result of the conditional formating should be that if a cell contains either C,EB,O,P,or VB the cell color will be red.

    I entered Formula is =IF(OR(H="C",H="EB",H="O",H="P",H="VB"),1,0) but it's not working. Please help.

  2. #2
    VBAX Mentor CBrine's Avatar
    Joined
    Jun 2004
    Location
    Toronto, Canada
    Posts
    387
    Location
    Try changing this
    =IF(OR(H="C",H="EB",H="O",H="P",H="VB"),1,0)
    to this
    =IF(OR(H2="C",H2="EB",H2="O",H2="P",H2="VB"),1,0)
    or change H2 to whatever the first cell of the selected range is.

    The conditional formatting is smart enough to increment the H2 to H3, H4, etc...
    The most difficult errors to resolve are the one's you know you didn't make.


  3. #3
    Site Admin
    Urban Myth
    VBAX Guru
    Joined
    May 2004
    Location
    Oregon, United States
    Posts
    4,940
    Location
    Hi, welcome to the board!!

    If you select the H1, then press Ctrl + Spacebar (select entire column, ensuring H1 has the initial focus), go to conditional formatting, Formula Is ...

    =(H1="C")+(H1="EB")+(H1="O")+(H1="P")+(H1="VB")
    Make sure the references are relative and not absolute (absolute will have the Dollar signs { $ } preceeding the reference row and/or column).

    Edit: Don't take a break before posting. LOL!

  4. #4
    VBAX Master TonyJollans's Avatar
    Joined
    May 2004
    Location
    Norfolk, England
    Posts
    2,291
    Location
    Hi template_girl,

    Welcome to VBAX!

    firefytr's solution is good, or ..

    ..sticking with your original format the IF is implicit in the situation and you do not need to specify it - it is enough to say ..
    =OR(H1="C",H1="EB",H1=O",H1="P",H1="VB")
    Enjoy,
    Tony

    ---------------------------------------------------------------
    Give a man a fish and he'll eat for a day.
    Teach him how to fish and he'll sit in a boat and drink beer all day.

    I'm (slowly) building my own site: www.WordArticles.com

  5. #5
    Site Admin
    Urban Myth
    VBAX Guru
    Joined
    May 2004
    Location
    Oregon, United States
    Posts
    4,940
    Location
    Hi template_girl,


    Did any of these help you out? If so, we can mark this thread Solved.

Posting Permissions

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