make command button invisible

  • Thread starter Thread starter Excel-VBA Dummy
  • Start date Start date
E

Excel-VBA Dummy

Could someone please tell me the syntax to make a command
button visible or invisible?

I was hoping it would be something easy like:

commandbutton.visible = false

but that isn't working.

thanks for any help
 
I just recorded this
Sub Macro7()
'
' Macro7 Macro
' Macro recorded 6/29/2004 by Don Guillett
'

'
Application.CommandBars("Control Toolbox").Visible = True
ActiveSheet.Shapes("CommandButton1").Select
Range("J15").Select
Application.CommandBars("Control Toolbox").Visible = False
End Sub

Seems like a lot of bother. Why not use a button from forms toolbar or a
shape from drawing. Easier.
Sub hideshape()
ActiveSheet.Shapes("rectangle 4").Visible = False
End Sub
 
If you use a command button from the "control toolbox " instead of the
"forms toolbar", you can set the visible property.

Commandbutton1.visible = False
or
Commandbutton1.visible = True


HTH

Ken
 
Thank you. This helped alot. I press the command button,
run a macro to make it invisible, copy the current
spreadsheet to another location, and then make the button
visible again.

The only thing that isn't working now - the button doesn't
become visible again, unless I close and re-open the
spreadsheet. Do you know how I can fix this?
 
Hi

I am not sure exactly what you are trying to do, but try something like

ThisWorkbook.Sheets("sheet1").CommandButton1.Visible = False
ThisWorkbook.Sheets("sheet2").Copy
ThisWorkbook.Activate
ThisWorkbook.Sheets("sheet1").CommandButton1.Visible = True


HTH

Ken
 
Back
Top