ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Make a button disappear (https://www.excelbanter.com/excel-programming/332531-make-button-disappear.html)

Aaron Howe[_2_]

Make a button disappear
 
Is there a specific piece of code to remove a form/control button from a
worksheet? Have tried many things, none of them working! I don't mind if
it's just hidden actually, so long as it can't be seen by the end user once
the code has run its course

Ron de Bruin

Make a button disappear
 
Try this

ActiveSheet.Shapes("yourbutton").Visible = False

Or

ActiveSheet.Shapes("yourbutton").Delete


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Aaron Howe" wrote in message ...
Is there a specific piece of code to remove a form/control button from a
worksheet? Have tried many things, none of them working! I don't mind if
it's just hidden actually, so long as it can't be seen by the end user once
the code has run its course




Tom Ogilvy

Make a button disappear
 
for a commandbutton
Activesheet.Shapes("CommandButton1").Delete

or

Activesheet.Shapes("CommandButton1").Visible = False

for a button from the forms toolbar

Activesheet.Buttons("Button 1").Delete

or

Activesheet.buttons("button 1").Visible = False


If you are going to use the button again, I would hide and unhide it rather
than adding a new button each time.

--
Regards,
Tom Ogilvy


"Aaron Howe" wrote in message
...
Is there a specific piece of code to remove a form/control button from a
worksheet? Have tried many things, none of them working! I don't mind if
it's just hidden actually, so long as it can't be seen by the end user

once
the code has run its course




Aaron Howe[_2_]

Make a button disappear
 
That worked, have never heard of the Shapes command before though!!
Thanks ;-)

"Tom Ogilvy" wrote:

for a commandbutton
Activesheet.Shapes("CommandButton1").Delete

or

Activesheet.Shapes("CommandButton1").Visible = False

for a button from the forms toolbar

Activesheet.Buttons("Button 1").Delete

or

Activesheet.buttons("button 1").Visible = False


If you are going to use the button again, I would hide and unhide it rather
than adding a new button each time.

--
Regards,
Tom Ogilvy


"Aaron Howe" wrote in message
...
Is there a specific piece of code to remove a form/control button from a
worksheet? Have tried many things, none of them working! I don't mind if
it's just hidden actually, so long as it can't be seen by the end user

once
the code has run its course






All times are GMT +1. The time now is 10:04 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com