Results 1 to 4 of 4

Thread: [RESOLVED] Excel - how do you hide a button

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2002
    Posts
    382

    Resolved [RESOLVED] Excel - how do you hide a button

    How can I hide and then unhide a button on a worksheet? Thanks.

  2. #2
    Banned
    Join Date
    Nov 2005
    Posts
    2,367

    Re: Excel - how do you hide a button

    Like this?

    VB Code:
    1. Private Sub CommandButton1_Click()
    2.     CommandButton1.Visible = False
    3. End Sub
    4.  
    5. Private Sub Worksheet_Activate()
    6. CommandButton1.Visible = True
    7. End Sub

  3. #3
    Frenzied Member DKenny's Avatar
    Join Date
    Sep 2005
    Location
    on the good ship oblivion..
    Posts
    1,171

    Re: Excel - how do you hide a button

    Hopefully this give you the general idea.

    You will need to change "CommandButton1" to the name of your button and will need to change the worksheet number to whichever sheet has the button.


    VB Code:
    1. Sub ToggleButton()
    2.     With Worksheets(1).Shapes("CommandButton1")
    3.         If .Visible = False Then
    4.             .Visible = True
    5.         Else
    6.             .Visible = False
    7.         End If
    8.     End With
    9. End Sub
    Declan

    Don't forget to mark your Thread as resolved.
    Take a moment to rate posts that you think are helpful

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2002
    Posts
    382

    Re: Excel - how do you hide a button

    Terrific. Thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width