+ Reply to Thread
Results 1 to 11 of 11

Need CountCellsByColor formula to update automatically without pressing "F2" "Enter"

  1. #1
    Registered User
    Join Date
    07-19-2016
    Location
    Colorado
    MS-Off Ver
    Microsoft Office 15
    Posts
    22

    Need CountCellsByColor formula to update automatically without pressing "F2" "Enter"

    Hi,
    I currently have a module that allows the "Mil Pay" tab of my workbook to run a CountCellsByColor formula. The problem i am running into is if i change the color of the cell I am referencing the formula will not update unless I press "F2" and "Enter". My goal is really to have a numerical value of 1 populate in cells "D,F,H,J" when the color in cells "E,G,I,K" change to green or RGB 0,255,0. If there is a better way for this to happen (and have it update when the cell is changed from green to no fill automatically) I would be very appreciative if you could show me.


    Attached below is the spreadsheet with my current progress on the 'Mil Pay" tab and testing out the formula in cell D2.
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    07-19-2016
    Location
    Colorado
    MS-Off Ver
    Microsoft Office 15
    Posts
    22

    Re: Need CountCellsByColor formula to update automatically without pressing "F2" "Enter"

    I forgot to add the module that is enabling the CountCellsByColor formula is "Module1" please disregard the other module

  3. #3
    Forum Contributor
    Join Date
    06-28-2016
    Location
    Pennsylvania, USA
    MS-Off Ver
    2013
    Posts
    308

    Re: Need CountCellsByColor formula to update automatically without pressing "F2" "Enter"

    Conditional formatting could probably accomplish it, if you explain your criteria for coloring the cells?

    My suggestion is to upload a Before and After demonstrating what you actually want. It is a lot easier than trying to reverse engineer what you have already accomplished. Basically remove the superfluous information, and dumb down the workbook, so we can clearly see what you are trying to accomplish, and how. Manually mock up your results, and make sure there are enough examples to see how you expect your results to turn out.

  4. #4
    Registered User
    Join Date
    07-19-2016
    Location
    Colorado
    MS-Off Ver
    Microsoft Office 15
    Posts
    22

    Re: Need CountCellsByColor formula to update automatically without pressing "F2" "Enter"

    TheN I did not think of a before and after but that probably would have been a good way to go. I unfortunately do not have a before any longer.

    My criteria for coloring the cells is to double click a cell (E2 in this case which shows the date the report is due) once a report is completed to turn it green. I would like a numerical value returned in another cell (D2) once the cell (E2) is colored green. The numerical value will help with other formulas I would like to do on this workbook as it is easier to deal with numerical values than colors. I hope this helps and thank you for your input!

  5. #5
    Forum Contributor
    Join Date
    06-28-2016
    Location
    Pennsylvania, USA
    MS-Off Ver
    2013
    Posts
    308

    Re: Need CountCellsByColor formula to update automatically without pressing "F2" "Enter"

    How about something like this?

    Instead of having your formula color then deal with colorings etc. Have it do some other output on double click, and base your other formulas off that. That way, it can auto-populate as you wanted.

    I used simple formulas based on it populating the F column with "Completed" once you double clicked the cell in E2 (pretty sure you don't need help making that change in your code).

    I used conditional formatting in the E column with this formula:

    Please Login or Register  to view this content.
    Then a simple IF statement in the D column based on the "Completed" being entered.

    If I understand your end goal correctly, you could have it populate the D column with "Completed" and just use conditional formatting based on that, then have your other formulas based on that instead of a number (text is just as easy, right?)

    In that case, you would instead use:

    Please Login or Register  to view this content.
    and be capable of simultaneously applying to all your cells at once.

    Hope that helps.
    Attached Files Attached Files
    Last edited by TheN; 08-14-2016 at 01:00 PM.

  6. #6
    Registered User
    Join Date
    07-19-2016
    Location
    Colorado
    MS-Off Ver
    Microsoft Office 15
    Posts
    22

    Re: Need CountCellsByColor formula to update automatically without pressing "F2" "Enter"

    TheN thanks for the reply but I am trying to avoid having more columns and having to type in any text on this workbook. There are also additional columns I would like to add later. If there is no solution for my problem I will go the route you suggested with check marks. If possible though I would like to make it easy for someone to simply double click a cell and have it turn green and then get a numerical value in column D which will be hidden later if it is able to be done.

  7. #7
    Forum Contributor
    Join Date
    06-28-2016
    Location
    Pennsylvania, USA
    MS-Off Ver
    2013
    Posts
    308

    Re: Need CountCellsByColor formula to update automatically without pressing "F2" "Enter"

    Please see my edited answer, I believe the second part is pretty much what you are asking for.

    This time, I used:

    Please Login or Register  to view this content.
    for the conditional formatting, and based it on your double click producing a 1 in the cell to the left of the cell you are clicking on.

    It can obviously be tweaked further, but that should demonstrate the basic idea? That is what you were asking for, more or less correct? Or I am I missing some other expected result?
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    07-19-2016
    Location
    Colorado
    MS-Off Ver
    Microsoft Office 15
    Posts
    22

    Re: Need CountCellsByColor formula to update automatically without pressing "F2" "Enter"

    TheN What I am trying to accomplish is to have the 1 generate from the green background color in cell E. Column D will be hidden if I am able to accomplish this as I am trying to avoid having to type anything into the spreadsheet if possible. The main goal is to have column D return the value of 1 if column E is green. The reason for this is my original spreadsheet allows someone do double click a cell and turn it green. In the end you will only see columns E,G,I,K as columns D,F,H,J will be hidden.

  9. #9
    Forum Contributor
    Join Date
    06-28-2016
    Location
    Pennsylvania, USA
    MS-Off Ver
    2013
    Posts
    308

    Re: Need CountCellsByColor formula to update automatically without pressing "F2" "Enter"

    I am saying that you can tweak the end result of the double click to produce a numeric value in the cell, and base everything else off of that. Or, you can simply add in a string that does that if your code works already. Dealing with colors is quite frankly, a pain in the butt, which is why I was suggesting you just use conditional formatting and eliminate dealing with colors in VBA. Also, you have the double clicking applied to the whole sheet instead of individual ranges.

    How about you watch this and tweak it ever so slightly to work for your workbook (basically flip around the rows in either the workbook itself, or your VBA).

    https://www.youtube.com/watch?v=-B2R52y4eK4

    He uses Data validation and things like that which will make the workbook a lot more robust. You also don't have it set up so the entire sheet turns green when double clicked.

    Here's the original code for that video if you don't feel like watching the whole thing:

    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    07-19-2016
    Location
    Colorado
    MS-Off Ver
    Microsoft Office 15
    Posts
    22

    Re: Need CountCellsByColor formula to update automatically without pressing "F2" "Enter"

    TheN I appreciate the post I have it set up so a single cell turns green IE when you click on a date in cell D to turn it green and I am ok with it being applied to the whole sheet as other sheets have different ranges and those ranges can change in the future. I would like to keep the date in the cell if I can instead of putting a numeric number in that particular cell. I know dealing with colors is a pain as I have tried working with this for weeks but that is why I am looking for help at this point. I will look at the code you provided above and see if I can tweak my current code and see if that works but if anyone else has any other ideas or how to make it so my current formula doesn't need me to press F2 and Enter that would be very much appreciated as well.

    Thank you again TheN for your suggestions!

  11. #11
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Need CountCellsByColor formula to update automatically without pressing "F2" "Enter"

    Hello PsychicFish,

    It seems redundant to place a value of one in a cell when the color is changed. You simply can place one in the cell and not change the color if your

    intent is simply to sum those cells.

    I wrote an improved macro to return the count of colored cells in 3 ways. The cells can be counted by cell color, text color, or color of the

    borders around the cell. The macro can be used as a UDF on a worksheet. It will update automatically when any other formula calculates. The notes

    in the macro explain the syntax and argument types and names. If you have any questions, please ask.

    Macro Code
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

+ 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. Replies: 4
    Last Post: 11-17-2013, 12:05 PM
  2. [SOLVED] How to USE """"" cells count """"" change font color
    By austin123456 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-09-2013, 06:14 AM
  3. [SOLVED] Powerpoint Macro for Pressing "Enter" Key after Commas in First Slide in Normal View
    By mlexcelhelpforum in forum PowerPoint Programing
    Replies: 1
    Last Post: 08-02-2012, 04:09 AM
  4. VBA editor auto changes "." to "'#" as you type ... not just after pressing <enter>?
    By Stripey_uk in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 01-04-2011, 08:00 AM
  5. Replies: 5
    Last Post: 10-12-2010, 06:46 AM
  6. Automatically click "Update Links" & "Continue"
    By paulharvey in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-03-2006, 12:35 PM
  7. [SOLVED] If changed array formula reduce ""\""\""\ - signs to #Missing, will it make ...
    By Maria J-son in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-05-2006, 08:25 AM
  8. Replies: 5
    Last Post: 02-22-2006, 02:50 PM

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