+ Reply to Thread
Results 1 to 8 of 8

How to hide command button based on another cell?

  1. #1
    Forum Contributor
    Join Date
    11-17-2009
    Location
    PA USA
    MS-Off Ver
    Excel 2000
    Posts
    184

    How to hide command button based on another cell?

    I have a command button on a worksheet, not in a user form. I know the command button has a property called Visible that I can manually set to False.

    I want to set this property to False if the value of the B3 cell is less than 2.000

    Thank you for helping me.
    Last edited by proepert; 01-16-2010 at 07:10 PM.

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: How to hide command button based on another cell?

    in the worksheet module
    Please Login or Register  to view this content.
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Forum Contributor
    Join Date
    11-17-2009
    Location
    PA USA
    MS-Off Ver
    Excel 2000
    Posts
    184

    Re: How to hide command button based on another cell?

    Thank you very much.

  4. #4
    Forum Contributor
    Join Date
    07-22-2009
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    122

    Re: How to hide command button based on another cell?

    This code does help, i have a simular question on this issue, how do you have the button hide based on the value from another sheet in the workbook?

    Here is the code i have, but not sure if it is correct:

    <code>

    Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
    If Worksheets("Reference").Range("L18") > 0 Then
    Me.CommandButton1.Visible = True
    Else
    Me.CommandButton1.Visible = False
    End If
    End Sub

    </code>

  5. #5
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: How to hide command button based on another cell?

    paxile2k
    please start a new thread linking to this one if you want to

  6. #6
    Registered User
    Join Date
    12-11-2013
    Location
    Melbourne AUSTRALIA
    MS-Off Ver
    Excel 2013
    Posts
    16

    Re: How to hide command button based on another cell?

    Hi Martin,

    I came across this thread with your VBA solution which fit the bill/works faultlessly for a small project I was doing however I only just realized it works for only 1 Button. Is there a way I can add additional buttons each referencing it's own individual cell? There is also one button which needs to show based on more than 1 cell.

    I adjusted your code to suit the condition as I only need the button(s) to appear when an entry is mad in a specific cell. The buttons are used to clear a range of cells.

    Please Login or Register  to view this content.
    Any assistance would be greatly appreciated

    Regards

    Tui
    Last edited by arlu1201; 01-27-2014 at 09:19 AM.

  7. #7
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: How to hide command button based on another cell?

    tittbb,

    Welcome to the forum.

    I have added code tags to your post. As per forum rule 3, you need to use them whenever you put any code in your post. Please add them in future. In order to put code tags, either type [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] at the end of it, OR you can highlight your code and click the # icon at the top of your post window.

    Also, you need to post your question in a new thread, it's against the forum rules to post a question in the thread of another user. If you create your own thread, any advice will be tailored to your situation so you should include a description of what you've done and are trying to do. Also, if you feel that this thread is particularly relevant to what you are trying to do, you can surely include a link to it in your new thread.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  8. #8
    Registered User
    Join Date
    12-11-2013
    Location
    Melbourne AUSTRALIA
    MS-Off Ver
    Excel 2013
    Posts
    16

    Re: How to hide command button based on another cell?

    Ok understood the first part (what do code tags look like) however I don't get the second. How do I then get a response from the person who wrote the original code where they would be better placed to respond?
    Last edited by tittbb; 01-27-2014 at 09:47 AM.

+ 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