Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Protect/Unprotect Sheet from Macro
Hi All
I have a worksheet that in large part has locked cells, the sheet is then protected. This of course disables sort. What I am trying to do is unprotect the sheet, do the sort and then protect the sheet. I have not as yet added a password. If I do the above manually from the UI, all is OK, but the macro that follows fails on the sort method. The sheet is showing unprotected. Problem in both xl97 and xl2002. ActiveSheet.Unprotect Selection.Sort Key1:=Range("B5"), Order1:=xlAscending, Header:=xlGuess, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _ DataOption1:=xlSortNormal ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True TIA Cheers Nigel |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Protect/Unprotect Sheet from Macro
Sorry everyone - stupid mistake - its nothing to do with protection the sort
method relies on a selection that I excluded. Cheers Nigel "Nigel" wrote in message ... Hi All I have a worksheet that in large part has locked cells, the sheet is then protected. This of course disables sort. What I am trying to do is unprotect the sheet, do the sort and then protect the sheet. I have not as yet added a password. If I do the above manually from the UI, all is OK, but the macro that follows fails on the sort method. The sheet is showing unprotected. Problem in both xl97 and xl2002. ActiveSheet.Unprotect Selection.Sort Key1:=Range("B5"), Order1:=xlAscending, Header:=xlGuess, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _ DataOption1:=xlSortNormal ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True TIA Cheers Nigel |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Code to protect/unprotect a sheet using a macro with password | Excel Discussion (Misc queries) | |||
Excel VBA-Protect and unprotect sheet with BVA | Excel Programming | |||
Protect/unprotect sheet with password with VBA? | Excel Programming | |||
Macro to protect and unprotect | Excel Programming | |||
VBA code - protect and unprotect a sheet | Excel Programming |