Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 94
Default Sorting a protected worksheet

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
--
Thanks, Kevin
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 52
Default Sorting a protected worksheet

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

"AFSSkier" wrote:

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
--
Thanks, Kevin

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sorting a protected worksheet nigsy Excel Worksheet Functions 4 June 21st 08 10:33 AM
Sorting a Protected Worksheet Shannon Excel Discussion (Misc queries) 1 September 25th 07 01:11 AM
Sorting on a protected worksheet Sue Excel Discussion (Misc queries) 6 June 12th 05 09:26 AM
Sorting protected worksheet Phyllis Excel Discussion (Misc queries) 3 December 15th 04 11:27 PM
Sorting a protected worksheet Frank Kabel Excel Programming 0 April 7th 04 02:52 PM


All times are GMT +1. The time now is 02:04 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"