Hide Macro Button

Doogs2009

Board Regular
Joined
Nov 18, 2009
Messages
140
Hi
Is there some simple code I can write to add to some VBA, that will hide a macro button after its been activated so it does not show in the worksheet. Then upon opening that workbook again at a later date, the macro button will be visible. So I guess I am after some code for Hide, then Reveal on opening!!!
Thanks guys
Craig
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Hello

Try this, put a forms button named Button 1, on sheet1 change suit your needs.

Standed module
Code:
Sub test()
  'your code
  Sheet1.Shapes("Button 1").Visible = msoFalse
End Sub


Thisworkbook module
Code:
Private Sub Workbook_Open()
  Sheet1.Shapes("Button 1").Visible = msoTrue
End Sub
 
Last edited:
Upvote 0
You could also hide it using this in your macro it intializes:
Code:
YourButtonNameHere.Visible = False
This will work even if you copy the sheet using a different name.
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,278
Members
452,902
Latest member
Knuddeluff

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