+ Reply to Thread
Results 1 to 8 of 8

Show command Button on worksheet when cell = True

  1. #1
    Forum Contributor
    Join Date
    02-20-2009
    Location
    Manchester, England
    MS-Off Ver
    Excel 2007
    Posts
    467

    Show command Button on worksheet when cell = True

    On the attached example, i have a check-box with controls cell M4.

    There is also a command button on here, which i want to be visible when the cell value of M4 is "TRUE" and not visible when the cell value is "FALSE".

    I assume i need to write some code into the worksheet to do this but don't know what to do. Could someone please help.

    Many thanks.
    Attached Files Attached Files
    Last edited by adam2308; 12-20-2009 at 05:14 PM.

  2. #2
    Forum Contributor mewingkitty's Avatar
    Join Date
    09-29-2008
    Location
    Fort McMurray, Alberta, Canada
    MS-Off Ver
    Excel 2003
    Posts
    949

    Re: Show command Button on worksheet when cell = True

    I've never seen a Mouse Movement triggered macro before. I do know that for selection change this works:
    Please Login or Register  to view this content.
    mew!
    =IF(AND(OR(BLONDE,BRUNETTE,REDHEAD),OR(MY PLACE,HER PLACE),ME),BOW-CHICKA-BOW-WOW,ANOTHER NIGHT ON THE INTERNET)

  3. #3
    Forum Expert davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2010
    Posts
    1,884

    Re: Show command Button on worksheet when cell = True

    You could right-click the Include Control and assign the following macro to it:

    Please Login or Register  to view this content.
    Is your code running too slowly?
    Does your workbook or database have a bunch of duplicate pieces of data?
    Have a look at this article to learn the best ways to set up your projects.
    It will save both time and effort in the long run!


    Dave

  4. #4
    Registered User
    Join Date
    11-20-2009
    Location
    Raymond,WA
    MS-Off Ver
    Excel 2002
    Posts
    40

    Re: Show command Button on worksheet when cell = True

    A one line solution:

    commandButton1.visible = Range("m4")

    Hope this helps

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

    Re: Show command Button on worksheet when cell = True

    Hello adam2308,

    The macro below has been attached to the check box. This removes the dependency of using a linked cell and triggers when the check box changes. The attached workbook has the changes installed.
    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!)

  6. #6
    Forum Contributor
    Join Date
    02-20-2009
    Location
    Manchester, England
    MS-Off Ver
    Excel 2007
    Posts
    467

    Re: Show command Button on worksheet when cell = True

    Hi guys,

    Thanks for your replies but i am still struggling. I tried the method of mewingkitty's and it did the job in the example workbook that i attached earlier but when i tried do the same to my actual workbook it didn't work any longer and i can't understand why?

    I have now attached my actual workbook, hopefully someone can see where i am going wrong. On this workbook there are two checkboxes (first tryscorer and last tryscorer) that affect whether the command button should be showing or not.

    The Command Button should be visible if either the 'first tryscorer' or the 'last tryscorer' checkbox is checked or even both are checked and not visible if both are un-checked.

    Thanks.
    Attached Files Attached Files

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

    Re: Show command Button on worksheet when cell = True

    Hello Adam2308,

    I revised the macro for the check boxes. The changed has been added to the attached workbook.
    Please Login or Register  to view this content.
    Attached Files Attached Files

  8. #8
    Forum Contributor
    Join Date
    02-20-2009
    Location
    Manchester, England
    MS-Off Ver
    Excel 2007
    Posts
    467

    Re: Show command Button on worksheet when cell = True

    Thanks Leith, this works perfectly.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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