+ Reply to Thread
Results 1 to 11 of 11

Conditional Format a row based on a value in a cell

  1. #1
    Forum Contributor
    Join Date
    10-29-2009
    Location
    London
    MS-Off Ver
    Excel 2013
    Posts
    125

    Conditional Format a row based on a value in a cell

    Hi,

    I have a data from an external source (the web) in range A4:G433

    in Column H = Team A, Column J = Team B an X in a cell will show players picked for each Team

    I have tried to apply Conditional Formatting (CF) to the data but each time it is refreshed the range in the 'Applies to' dialog box of CF is changed ... I have no idea why, very annoying!!! Else, it would have worked fine.

    So, I turn to VBA change event, but not sure how to write the code.

    What I need is, examples below :-

    If there is an X anywhere in Col H (Team A), I would like cells in the same row A:H to be highlighted green.
    So, if H10 contains X, A10:H10 will be green

    If there is an X anywhere in Col J (Team B), I would like cells in the same row A:J to be highlighted purple.
    So, if J233 contains X, A233:J233 will be purple

    I hope this makes sense.

    Thank you!

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Conditional Format a row based on a value in a cell

    What formulas did you use for Conditional Formatting?
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Forum Contributor
    Join Date
    10-29-2009
    Location
    London
    MS-Off Ver
    Excel 2013
    Posts
    125

    Re: Conditional Format a row based on a value in a cell

    I used =$H4="X" for green =$J4="X" for purple
    and applied to range =$A$4:$J$433 but this range change to =$H$4:$J$433 each time I refreshed the data!!!!

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Conditional Format a row based on a value in a cell

    That strange... do you have other conditional formatting in some of those cells that weren't previously cleared?

    is it possible to upload the sheet here for us to review?

  5. #5
    Forum Contributor
    Join Date
    10-29-2009
    Location
    London
    MS-Off Ver
    Excel 2013
    Posts
    125

    Re: Conditional Format a row based on a value in a cell

    Sure, here you go ....

    Look at the CF range then R Click on data then click refresh you will see the CF range alter.
    Attached Files Attached Files

  6. #6
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Conditional Format a row based on a value in a cell

    It seems to work fine when I open it and close it in Excel 2007. Perhaps a bug in your 2010 version?

    Hopefully someone with access to 2010 currently can test to confirm....

  7. #7
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Conditional Format a row based on a value in a cell

    OK, I've had a look. The CF range was adjusting.
    You need to right click in your web query area and put a check mark in "Preserve cell formatting".
    I also selected "Overwrite existing cells with new data, clear unused cells"
    The CF range now does not adjust after refreshing.

    PS - poor old Tiger - nobody picks him anymore.
    Last edited by Cutter; 05-08-2012 at 11:34 AM.

  8. #8
    Forum Contributor
    Join Date
    10-29-2009
    Location
    London
    MS-Off Ver
    Excel 2013
    Posts
    125

    Re: Conditional Format a row based on a value in a cell

    Cutter, thank you so much !!!

  9. #9
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Conditional Format a row based on a value in a cell

    right-click the data table, choose 'data range properties' and check the 'preserve cell formatting' option.

    ne'er mind - shoulda refreshed. ;-)
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  10. #10
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Conditional Format a row based on a value in a cell

    You're welcome.

  11. #11
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Conditional Format a row based on a value in a cell

    The part that it was a web query didn't click in my little head ;(... so didn't realize that was the issue... thanks for the assist guys.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1