+ Reply to Thread
Results 1 to 7 of 7

Get Color Count Issue

  1. #1
    Registered User
    Join Date
    10-24-2017
    Location
    Portsmouth, England
    MS-Off Ver
    2013
    Posts
    16

    Get Color Count Issue

    Hi, i have been using the Get Color Count Formula to count all red cells in a workbook (there is a macro in the background to allow this to work). However after turning a cell red I have to click into the formula and press enter for it to update. This is a particular issue as it is a workbook that I have created for other users to update who aren't very confident with Excel.

    Here is the Macro I used:
    Please Login or Register  to view this content.
    Does anyone know how to fix this?

  2. #2
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: Get Color Count Issue

    Changing a cell colour does not trigger a recalculation. What I do in applications that use this technique is to create a button(s) to set the colour(s), and within the code attached to the button(s), I do a manual sheet calculate.

  3. #3
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,883

    Re: Get Color Count Issue

    May be make it volatile? If any other cell other than cells in your arguments change.

    I.E. Add Application.Volatile line to your UDF.

    Note: You will need to reconfirm the formula to make it volatile (if it's in a cell already). It will reset and apply volatility.

    Otherwise, you'll need some other trigger.
    ?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
    ― Robert A. Heinlein

  4. #4
    Registered User
    Join Date
    10-24-2017
    Location
    Portsmouth, England
    MS-Off Ver
    2013
    Posts
    16

    Re: Get Color Count Issue

    Please ignore this, I was trying to delete the comment but cannot find the button.

  5. #5
    Registered User
    Join Date
    10-24-2017
    Location
    Portsmouth, England
    MS-Off Ver
    2013
    Posts
    16

    Re: Get Color Count Issue

    Quote Originally Posted by Bob Phillips View Post
    Changing a cell colour does not trigger a recalculation. What I do in applications that use this technique is to create a button(s) to set the colour(s), and within the code attached to the button(s), I do a manual sheet calculate.
    Thank you for the suggestion, however I am concerned it would confuse the staff that need to use it.

  6. #6
    Registered User
    Join Date
    10-24-2017
    Location
    Portsmouth, England
    MS-Off Ver
    2013
    Posts
    16

    Re: Get Color Count Issue

    Quote Originally Posted by CK76 View Post
    May be make it volatile? If any other cell other than cells in your arguments change.

    I.E. Add Application.Volatile line to your UDF.

    Note: You will need to reconfirm the formula to make it volatile (if it's in a cell already). It will reset and apply volatility.

    Otherwise, you'll need some other trigger.
    I have tried to pop it in the code, however it hasn't made a difference. I apologies, I'm not too clued up with VBA, and generally use code I find off of the internet so don't actually understand the logistics of it..

  7. #7
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,883

    Re: Get Color Count Issue

    Unless there is some other cell value change etc is taking place in the sheet, or some calculation update is taking place else where in the sheet, Application.Volatile will not impact.

    In that case you'd want to trigger re-evaluation of the UDF through some other tigger.

    Exactly "how" you are going to trigger will depend on your workbook set up and what you can live with.

    Ex: Say that range "A1:A10" is the argument supplied to the UDF. You could trigger the re-evaluation whenever selection change occurs on the sheet and it's not in "A1:A10" range. Though there are some drawbacks.

    Other options that I can think of are...
    1. If it's based on single column, make use of AutoFilter (filter by color) and Subtotal() function.
    2. Use legacy Excel4Macro functions combined with Named Range(can't remember where I posted this as it was few years ago...)
    3. If there is some logic/condition for coloring cell red. Then count based on condition (though I'm not sure what process you use).

    Though it may be much simpler to just tie it to button that's always visible at top of the sheet.

    If you need further help, I'd recommend uploading sample workbook that replicates your actual workbook with desensitized info.

+ 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] Cell Count If Background Color is a Certain Color - Automatically
    By woutie in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 09-10-2018, 08:20 AM
  2. User defined function- count color and count only visible rows
    By marsjanik1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-17-2016, 03:05 PM
  3. Replies: 4
    Last Post: 01-12-2016, 05:07 PM
  4. Count / Sum based on Background Color with Manual and Conditional Format Color
    By sam99 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-20-2014, 08:00 PM
  5. [SOLVED] Color cells issue
    By valgo54 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-26-2013, 03:22 PM
  6. [SOLVED] text count issue, it seems to count the formula also?
    By randypang in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-28-2013, 03:27 AM
  7. VBA Module counts background color, would like it to count font color
    By LawBeforeGrace in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-25-2013, 08:11 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