Hide Macro Button

Brutium

Board Regular
Joined
Mar 27, 2009
Messages
188
Hello ALL,

I have searched all over the various threads but I did not find anything that resembles my issue.

I have created a Workbook that uses a macro to create additional worksheets. The macro is activated by a button. What I would like to do is make sure that the user will not be able to click on the button once the sheets are created. Is there a way to either hide the button or disable the same button.

Any help would be greatly appreciated.

Thank you
Brutium
 

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.
Hi there,

Disable button:

Code:
CommandButton1.Enabled = False

Hide button:

Code:
CommandButton1.Visible = False
 
Upvote 0
Hello JamesW,

Thank you for your prompt response.

I am having difficulty identifying the name of my button. By just placing the command you gave me, it addresses "button1", but I am not sure what my button is called. Is there a way to find out what the button is called?

Brutium
 
Upvote 0
Hi,

Assuming the button is on the spreadsheet and not a form:

Make sure you are in edit mode in the control toolbox (the green set square/pencil/ruler thing), right click on your button and click on "properties". The name of the button is next to the header "(Name)". Make sure you come out of edit mode afterwards (click on the set square again).
 
Upvote 0
Hello JamesW,
Sorry if I sound stupid or something like that, but the Edit Mode, is it the same as the Design Mode I get under the Developer tab? If that is the case when I click on my botton I do not have the Properties, all I get is
Cut
Copy
Paste
Edit Text
Grouping
Order
Assign Macro...
Format Control...

Am I looking into the wrong thing?

Brutium
 
Upvote 0
How did you add the button to the sheet? Is it a command button from the control toolbox, or something else?
 
Upvote 0
Hello JamesW,

When I was creating the various sheets, I inserted from mthe Developer tab a button using the Insert-> Form Control button, and then I linked it to the macro I created, so that the user would be able to create additional sheets. Now, as I tried to explain earlier, I would like to disable or make disappear this button so that the users would not be able to insert additional sheet, otherwise they would get an error.

Thank for your help

Brutium
 
Upvote 0
In the actual macro use something like:
ActiveSheet.Shapes(Application.Caller).Visible = False
 
Upvote 0
Hello GlennUK,

Thank you for your prompt response.

Unfortunately it does not work. It comes back with Application.Caller=error 2023. I think because it is looking for Button1 and my button is not called as such. I do not know how to change the button's name. Any suggestions?

Brutium
 
Upvote 0
You said that you press the button to start the processing ... I assumed that you were going to hide the button in that macro ... isn't that the case?
 
Upvote 0

Forum statistics

Threads
1,224,603
Messages
6,179,850
Members
452,948
Latest member
UsmanAli786

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