Sorting a protected worksheet

A

AFSSkier

Is it possible to Sort a protected worksheet that has protected formulas?

I have a Workbook_Open sub that unprotects, then protects the active
worksheet (see below). The worksheet still won't allow sorting, even though
I have the AllowSorting:=True.

Also, is it possible to have the code clear itself or disable the
Workbook_Open sub after it runs? The original is an Macro Enabled Workbook.
On open, it's refreshed, then saved on our network as Workbook.xls format.
It's annoying to end user to have the code run every time they open the
workbook.

Sub Workbook_Open()
ActiveSheet.Unprotect Password:="mypassword"
'other code here for Refreshall, etc.
ActiveSheet.Protect Password:="mypassword", DrawingObjects:=True,
Contents:=True, Scenarios:=True _
, AllowFormattingCells:=True, AllowFormattingColumns:=True, _
AllowFormattingRows:=True, AllowInsertingColumns:=True, _
AllowDeletingColumns:=True, AllowDeletingRows:=True,
AllowSorting:=True, _
AllowFiltering:=True, AllowUsingPivotTables:=True
 
O

ordnance1

in front of you code add:

ActiveSheet.Unprotect

At the end of you code add:

ActiveSheet.Protect DrawingObjects:=False, Contents:=True, Scenarios:= _
False

you might also want to use Application.ScreenUpdating = False
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top