+ Reply to Thread
Results 1 to 23 of 23

Count Cells By Color not working with conditional formatting.

  1. #1
    Forum Contributor
    Join Date
    01-29-2019
    Location
    Drenthe, Netherlands
    MS-Off Ver
    Dutch Office 2019
    Posts
    291

    Question Count Cells By Color not working with conditional formatting.

    I like counting the amount of red cell trigger by conditional formatting. I found a nice script on the internet. It works wel when i color a cal myself. But the cells that are colored with conditional formatting don't get count. Is there a fix or a better script for this problem.
    A second software is a no go because of company policy.
    Please Login or Register  to view this content.
    Last edited by Frigide; 01-29-2019 at 03:14 PM.

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Count Cells By Color not working with conditional formatting.

    Try something like:

    Please Login or Register  to view this content.
    BTW: Your post does not comply with Rule 2 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Click on Edit to open your thread, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    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: Count Cells By Color not working with conditional formatting.

    DisplayFormat doesn't work in UDFs, at least as late as Excel 2010.
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Forum Contributor
    Join Date
    01-29-2019
    Location
    Drenthe, Netherlands
    MS-Off Ver
    Dutch Office 2019
    Posts
    291

    Re: Count Cells By Color not working with conditional formatting.

    Changed it. I don't know what te do with your line?
    Isn's the line already in the script?

  5. #5
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,080

    Re: Count Cells By Color not working with conditional formatting.

    Doesn't work in 2013 either.

  6. #6
    Forum Contributor
    Join Date
    01-29-2019
    Location
    Drenthe, Netherlands
    MS-Off Ver
    Dutch Office 2019
    Posts
    291

    Re: Count Cells By Color not working with conditional formatting.

    Is there an work around? Maybe change cell color without conditional formatting

  7. #7
    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: Count Cells By Color not working with conditional formatting.

    Your original function.

  8. #8
    Forum Contributor
    Join Date
    01-29-2019
    Location
    Drenthe, Netherlands
    MS-Off Ver
    Dutch Office 2019
    Posts
    291

    Re: Count Cells By Color not working with conditional formatting.

    I don't get it. My Original function is not working.

  9. #9
    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: Count Cells By Color not working with conditional formatting.

    With static formatting applied to both the reference range and the data range?

    Suggest you step through the code and watch it execute. See http://www.cpearson.com/excel/DebuggingVBA.aspx

  10. #10
    Forum Contributor
    Join Date
    01-29-2019
    Location
    Drenthe, Netherlands
    MS-Off Ver
    Dutch Office 2019
    Posts
    291

    Re: Count Cells By Color not working with conditional formatting.

    i don't find the problem. I'm no expert! Is it possible to count cells that ar collard by conditional formatting or is this like a hidden color?

  11. #11
    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: Count Cells By Color not working with conditional formatting.

    To repeat post 3, if a cell is colored by conditional formatting, then a function called from the worksheet (a user-defined function, "UDF") cannot determine the color.

    A UDF can determine the color of a cell that has static formatting.
    Last edited by shg; 02-01-2019 at 01:55 PM.

  12. #12
    Forum Contributor
    Join Date
    01-29-2019
    Location
    Drenthe, Netherlands
    MS-Off Ver
    Dutch Office 2019
    Posts
    291

    Re: Count Cells By Color not working with conditional formatting.

    Then the only thin i can think of is to make i mirror sheet and =if all the 1100 fields with the same limits like the conditional formatting does. Not only is it way to much work. When we found that other setpoint are better i can change everything again. Not a good idea!

  13. #13
    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: Count Cells By Color not working with conditional formatting.

    You can use a macro and run it from a command button.

    Or your UDF could use the same rule used for conditional formatting and count on that basis.

  14. #14
    Forum Contributor
    Join Date
    01-29-2019
    Location
    Drenthe, Netherlands
    MS-Off Ver
    Dutch Office 2019
    Posts
    291

    Re: Count Cells By Color not working with conditional formatting.

    The only thing i can think of is a extra cell next to the downloaden data compare the dowloaded cell with a other cell and give that extra cell a LL L A H HH en count them. But it wont be good looking.

  15. #15
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Count Cells By Color not working with conditional formatting.

    Something like this:


    Please Login or Register  to view this content.
    Last edited by xladept; 02-01-2019 at 07:42 PM. Reason: Typo

  16. #16
    Forum Contributor
    Join Date
    01-29-2019
    Location
    Drenthe, Netherlands
    MS-Off Ver
    Dutch Office 2019
    Posts
    291

    Re: Count Cells By Color not working with conditional formatting.

    The sheet where i want color counting.
    Row K9 to S9 is for counting the rows K9 for K10-K114, L9 for L10-L114 and so on.

    E to I is for setting up and lower limits. Every row is different.

    Maybe someone can help?
    Attached Files Attached Files

  17. #17
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Count Cells By Color not working with conditional formatting.

    This seems to work:

    Please Login or Register  to view this content.

  18. #18
    Forum Contributor
    Join Date
    01-29-2019
    Location
    Drenthe, Netherlands
    MS-Off Ver
    Dutch Office 2019
    Posts
    291

    Re: Count Cells By Color not working with conditional formatting.

    It works like a charm!! Tanks. Realy THANKS!!

  19. #19
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Count Cells By Color not working with conditional formatting.

    You're welcome and thanks for the rep!

  20. #20
    Forum Contributor
    Join Date
    01-29-2019
    Location
    Drenthe, Netherlands
    MS-Off Ver
    Dutch Office 2019
    Posts
    291

    Re: Count Cells By Color not working with conditional formatting.

    Quote Originally Posted by xladept View Post
    This seems to work:

    Please Login or Register  to view this content.
    Stil working very nice!! But i like to protect the sheet. With the other macro's i do this with

    ActiveSheet.Protect "xxxxx"
    ActiveSheet.Unprotect "xxxxx"

    But i dont know how to do it with this Macro

  21. #21
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Count Cells By Color not working with conditional formatting.

    Try:

    Please Login or Register  to view this content.

  22. #22
    Forum Contributor
    Join Date
    01-29-2019
    Location
    Drenthe, Netherlands
    MS-Off Ver
    Dutch Office 2019
    Posts
    291

    Re: Count Cells By Color not working with conditional formatting.

    And again works like a charm!! Thanks!!

  23. #23
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Count Cells By Color not working with conditional formatting.

    You're welcome and thanks for the rep!

+ 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. Count conditional formatting color
    By emina002 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-09-2016, 12:37 AM
  2. Conditional Color Scale Formatting Not Working
    By Merf in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-24-2015, 10:03 AM
  3. VBA Count Color of Conditional Formatting
    By roy__lam in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-21-2014, 01:08 PM
  4. Replies: 3
    Last Post: 05-30-2014, 10:24 AM
  5. Replies: 5
    Last Post: 09-24-2013, 03:42 PM
  6. Replies: 14
    Last Post: 10-19-2011, 08:27 AM
  7. Color Count in conditional formatting in pivot table
    By mangeshp4 in forum Excel General
    Replies: 4
    Last Post: 10-15-2010, 07:52 AM

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