Hiding Command Button

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Sure...along the lines of this if it is a command button on a UserForm:

Private Sub UserForm_Initialize()
If Range("A1").Value = "Yes" Then
CommandButton1.Visible = False
Else
CommandButton1.Visible = True
End If
End Sub


Or this if it is a command button on a worksheet:

Sub Test1()
If Range("A1").Value = "Yes" Then
ActiveSheet.CommandButton1.Visible = False
Else
ActiveSheet.CommandButton1.Visible = True
End If
End Sub

Modify for whatever it is that would trigger the Visible property. In these examples, it is the presence or absence of the value "Yes" in cell A1 of the active worksheet.
 
Upvote 0

Forum statistics

Threads
1,221,692
Messages
6,161,334
Members
451,697
Latest member
pedroDH

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