Macros in a protected sheet

HughT

Board Regular
Joined
Jan 6, 2012
Messages
113
Office Version
  1. 365
Platform
  1. Windows
I have a worksheet with a mixture of data entry cells and cells derived from formulas.

I want to protect the formula derived cells so I have locked them and protected the worksheet (no password).

I have various buttons running macros to perform bespoke filters. These are inoperative because the worksheet is protected.

Is there a way to allow the macros to run but still keep the worksheet protected so that users cannot overwrite cells with formulas?

Many thanks

HT
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Put
Code:
Sheets("sheet1").Unprotect
at the start of the code &
Code:
Sheets("sheet1").Protect
at the end, changing sheet name to suit.
 
Upvote 0
Many thanks, and apologies for late reply (been off to buy a dog!)

I tried this and now even with the worksheet unprotected, none of the buttons work. If I create a new button and assign a macro to it that doesn't work either!

Help!

HughT
 
Upvote 0
Can you run the macros manually?
Also what happens when you try to run a macro from a button?
 
Upvote 0
Macros run manually, but the buttons are disabled, so that I cannot even select them to format them etc when the worksheet is unlocked. If I create a new button and assign a macro to it, it still doesn't work, so presumably it is something to do with buttons permissions as opposed to the macro itself.
 
Upvote 0
Are you using Form Control Buttons, or ActiveX?
 
Upvote 0
A shape with a macro assigned to it - not sure which that is, sorry!
 
Upvote 0
That would be Form Control.
I cannot think of any reason why you would get that. Have you tried re-booting your computer since this first happened?
 
Upvote 0
Ah, the old ones are the best ones!

I haven't and can't at the moment, but I will give it try later.

Many thanks for your help.
 
Upvote 0
Let me know how it goes, another possibility is the workbook has become corrupted.
Is it just the one workbook that has problems?
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,191
Members
452,616
Latest member
intern444

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