+ Reply to Thread
Results 1 to 10 of 10

VBA to make shape appear based on cell value works but wont trigger with count if formula

  1. #1
    Registered User
    Join Date
    12-20-2019
    Location
    Paris, France
    MS-Off Ver
    Office 365 32 Bit
    Posts
    4

    VBA to make shape appear based on cell value works but wont trigger with count if formula

    I am using this formula to make a shape appear:

    Please Login or Register  to view this content.
    It works when I manually input the cell value, but when I use a countif formula to calculate the cell value the VBA won't run. Auto calculate is activated in the options menu.

    Please help!
    Last edited by AliGW; 12-20-2019 at 06:35 AM.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,830

    Re: VBA to make shape appear based on cell value works but wont trigger with count if form

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, 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

    (Note: this change is not optional. I have added these for you, as you are new here.)

    Please change your forum profile and specify exactly which 'latest' version of Excel you have: there is more than one possibility! Thanks.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow


    As a formula does not fire the Change event, only user input …

  4. #4
    Registered User
    Join Date
    12-20-2019
    Location
    Paris, France
    MS-Off Ver
    Office 365 32 Bit
    Posts
    4

    Re: VBA to make shape appear based on cell value works but wont trigger with count if form

    Thanks, can I do anything about that? I would like the formula to trigger the event or find an alternative workaround

  5. #5
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow


    You may work with the Worksheet_Calculate event, see the samples within this forum …

  6. #6
    Registered User
    Join Date
    12-20-2019
    Location
    Paris, France
    MS-Off Ver
    Office 365 32 Bit
    Posts
    4

    Re: VBA to make shape appear based on cell value works but wont trigger with count if form

    What a wonderful forum! Thank you for all your help. I must say I am overwhelmed by the feeling of collaboration and mutual support

  7. #7
    Registered User
    Join Date
    12-20-2019
    Location
    Paris, France
    MS-Off Ver
    Office 365 32 Bit
    Posts
    4

    Re: VBA to make shape appear based on cell value works but wont trigger with count if form

    Thanks, but no thanks will be heading to another forum.

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,830

    Re: VBA to make shape appear based on cell value works but wont trigger with count if form

    Hopefully one of our VBA specialists will give you a more detailed answer than MarcL did in post #5, for which I apologise on behalf of the forum. If I knew about these things, I would gladly help you myself. I am sure someone will help in due course - it hasn't been too long since you first posted, so just give it a while longer, please.

  9. #9
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: VBA to make shape appear based on cell value works but wont trigger with count if form

    There are only 2 ways to workaroud this issue.

    Either you store the value of A1 in another cell and monitor that in the Calculate-event wether it changed.

    Please Login or Register  to view this content.
    Or you monitor one of the dependents of the formula in A1 in the Change-event for a change in value.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

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

    Re: VBA to make shape appear based on cell value works but wont trigger with count if form

    You can use a UDF.

    Please Login or Register  to view this content.
    In the attached example change the value of A3. This will cause the COUNTIF formula in A1 to update which in turn will cause the 2 UDF formula to run and hide each shape if condition is false.
    Attached Files Attached Files
    Cheers
    Andy
    www.andypope.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. Select a shape based on a cell value and update the shape when value changes
    By BigAl99 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-14-2013, 12:06 PM
  2. Replies: 4
    Last Post: 10-22-2013, 09:22 AM
  3. Replies: 1
    Last Post: 12-19-2012, 05:29 PM
  4. [SOLVED] Count Rows Based On User Input & Trigger Print Of Pages Out Of Count Result
    By wliang in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-09-2012, 02:45 AM
  5. Formula that wont count a cell if its empty
    By bopsgtir in forum Excel General
    Replies: 9
    Last Post: 03-07-2011, 03:25 AM
  6. [SOLVED] How to make a cell trigger a Sound in Excel
    By justice in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-11-2006, 01:45 PM
  7. [SOLVED] How to trigger a selection change between a cell and a shape
    By Gerold Kriechbaumer in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-11-2006, 01:35 PM

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