+ Reply to Thread
Results 1 to 3 of 3

Hide command button

  1. #1
    MarcoR
    Guest

    Hide command button

    I have a command button to print a hidden worksheet.
    I want to be able to hide the button based on a condition of a cell.
    For example, if cell B6 = A, button is hidden, but if cell B6=B, button is
    visible and active for print.
    I saw a similar post on this but I could not figure out the code for my
    application.
    Please help.

  2. #2
    Cory
    Guest

    RE: Hide command button

    Marco,

    I'm assuming that your condition cell (B6) and your command button are on
    the same worksheet.

    If Range("B6") = "A" Then
    CommandButton1.Visible = True
    ElseIf Range("B6") = "B" Then
    CommandButton1.Visible = False
    End If

    Replace "CommandButton1" with whatever the name of your print button is. How
    the value in B6 is changed will effect where you put that code. For example,
    if B6 is modified from another worksheet (via a link) you could put that code
    in the Worksheet_Activate section of the worksheet containing the command
    button.

    "MarcoR" wrote:

    > I have a command button to print a hidden worksheet.
    > I want to be able to hide the button based on a condition of a cell.
    > For example, if cell B6 = A, button is hidden, but if cell B6=B, button is
    > visible and active for print.
    > I saw a similar post on this but I could not figure out the code for my
    > application.
    > Please help.


  3. #3
    MarcoR
    Guest

    RE: Hide command button

    Cory,

    Thank you so much.
    It worked!

    Marco.

    "Cory" wrote:

    > Marco,
    >
    > I'm assuming that your condition cell (B6) and your command button are on
    > the same worksheet.
    >
    > If Range("B6") = "A" Then
    > CommandButton1.Visible = True
    > ElseIf Range("B6") = "B" Then
    > CommandButton1.Visible = False
    > End If
    >
    > Replace "CommandButton1" with whatever the name of your print button is. How
    > the value in B6 is changed will effect where you put that code. For example,
    > if B6 is modified from another worksheet (via a link) you could put that code
    > in the Worksheet_Activate section of the worksheet containing the command
    > button.
    >
    > "MarcoR" wrote:
    >
    > > I have a command button to print a hidden worksheet.
    > > I want to be able to hide the button based on a condition of a cell.
    > > For example, if cell B6 = A, button is hidden, but if cell B6=B, button is
    > > visible and active for print.
    > > I saw a similar post on this but I could not figure out the code for my
    > > application.
    > > Please help.


+ 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