Macro to protect a sheet but allow sort, autofilter, charts, copy

exl

Board Regular
Joined
Feb 4, 2010
Messages
153
Office Version
  1. 2019
Platform
  1. Windows
My workbook consists of almost 25 sheets, I want to protect 11 sheets. My criteria for protecting are as follows:


  1. User cannot delete any cell
  2. User should be able to use SORT, AUTOFILTER, drop down selection from COMBO BOXES
  3. Most of the sheets contain charts, they should be updated as per the user selection
  4. User should not be able to see the formulas in the formula bar
  5. User should be able to copy the data

I have tried all the general options in Excel, which does all the above work, but they leave the cells unlocked, which means user can delete the contents

Thus I hope this can be achieved only by a macro, please help.
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Dear Exl,

Apart from 1 & 3 rest can be done by protected option before doing you have to select all the cells and format cells (CRTL+1) ==> protection tab uncheck Locked & check Hidden.

Filter cannot be applied after protection so before that apply filter.

Now press ALT+T+P+P Allow all users of this worksheet to:
check
1.select locked cells
2.select unlocked cells
3.sort
4.use autofilter


Thank You,
SK
 
Upvote 0
Dear Exl,

Apart from 1 & 3 rest can be done by protected option before doing you have to select all the cells and format cells (CRTL+1) ==> protection tab uncheck Locked & check Hidden.

Filter cannot be applied after protection so before that apply filter.

Now press ALT+T+P+P Allow all users of this worksheet to:
check
1.select locked cells
2.select unlocked cells
3.sort
4.use autofilter


Thank You,
SK

Dear SK,

I have already done what you have suggested. The problem is, yo achieve the desired results, we have to make certain cells unlocked which leaves them vulnerable. Can you suggest a solution in addition to what you already said, where user cannot modify any cells
 
Upvote 0
Would appreciate some help / guidance here
 
Upvote 0

Forum statistics

Threads
1,223,719
Messages
6,174,087
Members
452,542
Latest member
Bricklin

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