+ Reply to Thread
Results 1 to 8 of 8

Problem getting VBA to recognize RGB of conditionally formatted cells - only gets normal..

  1. #1
    Registered User
    Join Date
    01-28-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2010
    Posts
    3

    Problem getting VBA to recognize RGB of conditionally formatted cells - only gets normal..

    Hi Everyone,

    I'm coming up against a tricky problem, hoping someone can shed a little light for me. I've got conditional formatting on a sheet which highlights cells where data does not meet certain validation criteria (i.e. age is greater than realistic maximum, or one event's date is later than another one which it can't logically be). I'd like to have VBA check the (CF'd) RGB of each cell, and as per below, if there are 192,0,0 dark red cells (errors) to do thing 'A', else if there are only amber (warnings) 255,192,0 then provide option 'B'.

    I've been playing around with VBA:

    Please Login or Register  to view this content.
    The problem is that it seems like the code above ignores the CF cell colours and only pays attention to the underlying (and overridden with CF) cell colour, so this is falling flat at the moment.

    Any help would be massively appreciated.

    Thanks

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,657

    Re: Problem getting VBA to recognize RGB of conditionally formatted cells - only gets norm

    Cell.interior.color is a different property from cell.formatconditions.interior.color. You should post a small sample workbook.To attach a Workbook
    (please do not post pictures of worksheets)
    • Click Advanced (next to quick post),
    • Scroll down until you see "Manage Attachments",
    • Click that then select "add files" (top right corner).
    • Click "Select Files" find your file, click "open" click "upload"
    • Once the upload is completed the file name will appear below the input boxes in this window.
    • Click "Done" at bottom right to close the Attachment Manager.
    • Click "Submit Reply"
    Ben Van Johnson

  3. #3
    Registered User
    Join Date
    01-28-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Problem getting VBA to recognize RGB of conditionally formatted cells - only gets norm

    Hi There,

    Thanks for your reply, here's a sample. Cheers.
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    01-28-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Problem getting VBA to recognize RGB of conditionally formatted cells - only gets norm

    Hi, protonLeah. I've been playing around with your 'cell.formatconditions.interior.color' suggestion, but have found that 'interior' doesn't seem to be a supported property of 'formatconditions' (and none of the supported properties seem relevant to what I'm doing). Anymore thoughts on what to try? Cheers.

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Problem getting VBA to recognize RGB of conditionally formatted cells - only gets norm

    You'd make life easy on yourself if you would instead test the conditions that control conditional formatting.

    I won't say it's impossible to determine the Excel 2007 CF-induced cell formatting via VBA, but have seen several people waste a lot of time trying.
    Last edited by shg; 09-11-2013 at 09:56 AM.
    Entia non sunt multiplicanda sine necessitate

  6. #6
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,657

    Re: Problem getting VBA to recognize RGB of conditionally formatted cells - only gets norm

    Try this one:
    Please Login or Register  to view this content.

  7. #7
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,449

    Re: Problem getting VBA to recognize RGB of conditionally formatted cells - only gets norm

    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

  8. #8
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Problem getting VBA to recognize RGB of conditionally formatted cells - only gets norm

    Thanks for that, Andy. I guess it took 2007 to make the need apparent.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Sum of conditionally formatted cells by colour
    By codeyl5 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-25-2012, 09:42 AM
  2. [SOLVED] count conditionally formatted cells
    By littlefoot in forum Excel General
    Replies: 5
    Last Post: 07-12-2012, 08:40 AM
  3. Sum conditionally formatted cells
    By akabraha in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-04-2010, 02:22 PM
  4. Counting conditionally formatted cells
    By Nigel in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 04-27-2008, 04:00 PM
  5. Report for Conditionally Formatted Cells
    By Sige in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-21-2005, 08:26 AM

Tags for this Thread

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