user793468
user793468

Reputation: 4966

unable to sort or filter data on a protected sheet with locked cells

I have a sheet which is protected with locked cells. Even after checking the "sort" and "Auto filter" option while protecting the sheet, I am still unable to sort/filter the data.

I get the following message when I click the Sort button:

The cell or chart that you are trying to change is protected and therefore read-only. To modify a protected cell or chart, first remove protection...

Am I missing something?

Thanks in advance

Upvotes: 1

Views: 11485

Answers (1)

Doug Glancy
Doug Glancy

Reputation: 27478

Even with the settings as you mentioned, you can only sort if all the cells to be sorted are unlocked. You can autofilter even if the cells are locked, but you can't turn autofiltering on and off.

You're post is tagged excel-vba, so I'll mention that you can protect the sheet in code using UserInterfaceOnly:=True and then you can do all of the above using VBA:

Activesheet.Protect userinterfaceonly:=True, AllowSorting:=True, AllowFiltering:=True

Upvotes: 5

Related Questions