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

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.

Forum statistics

Threads
1,214,935
Messages
6,122,337
Members
449,077
Latest member
Jocksteriom

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