Sorting with Protected Cells

jc.021286

Well-known Member
Joined
Apr 12, 2010
Messages
725
Hey there, I've done quite a bit of research and have found this to be quite difficult. I have a worksheet that has 12 columns that a person can make a data entry into, but in order to add or delete or edit a row (#, name, dept. etc) they have to use either an "Add" or "Edit" button.

I have done the record macro and done things such as
Code:
For a = 1 to sheets.count
        For a = 1 To Sheets.Count
        Sheets(a).Protect Password:="Secret", UserInterfaceOnly:=True, AllowSorting:=True, AllowFiltering:=True 
Next a
to no avail...

I have applied the autofilter and need to enable the sort ascending and descending.

I thought about if a person selected the autofilter row "4:4" that it would unprotect, and then reprotect if the selection was not "4:4"... Though that does not work, as You can have selected "D9" and if you use the mouse to attempt the autofilter, that does not work...

If I had a Workbook_open() unprotect all the sheets and a before_save reprotect the cells. Would I then be able to simply have a worksheet_Change() macro where if the any of my "protected" cells underwent a change, it would undo/not allow the change... Would this essentially work to allow me to make get my desired result of a protected sheet with some functionality for sorting and filtering?

thanks,
jc
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).

Forum statistics

Threads
1,224,542
Messages
6,179,421
Members
452,913
Latest member
JWD210

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