hiding Command Button

aka_krakur

Active Member
Joined
Jan 31, 2006
Messages
438
Is there a way to hide the command button after it's already done what it needs to do. For instance, CommandButton1 just runs a macro to format a Worksheet. After the worksheet is formatted, the button now hovers over some of the data. I know how to set the option so it doesn't print; but as far as on the screen, can I hide it by a simple code at the end of the macro?
 
Well, thanks everyone for your help. I ended up using some of Dufus and Dave's combined. Here's what it looks like and it worked!!!
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Select Case Range("A1") = "Shipped Qty"
    Case True
        Sheets("ShippedQty-SummarybyYr").CommandButton1.Visible = xlVisible
    Case False
        Sheets("ShippedQty-SummarybyYr").CommandButton1.Visible = xlHidden
End Select
End Sub
Private Sub CommandButton1_Click()
If Sheets("ShippedQty-SummarybyYr").Range("A1") = "" Then
Sheets("ShippedQty-SummarybyYr").CommandButton1.Visible = xlHidden
MsgBox "You must copy/paste data from Viper Drill Down 1st!!"

Else
If Sheets("ShippedQty-SummarybyYr").Range("A1") = "Shipped Qty" Then
Sheets("ShippedQty-SummarybyYr").CommandButton1.Visible = xlVisible
 
Upvote 0

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

Forum statistics

Threads
1,225,477
Messages
6,185,210
Members
453,283
Latest member
Shortm88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top