Vba protected cells

Solved/Closed
SARC Posts 29 Registration date Saturday 7 August 2010 Status Member Last seen 31 August 2010 - 18 Aug 2010 à 07:37
 SARC - 20 Aug 2010 à 14:23
Hello,

I have used this code to protect sheets and i have made it not to select locked cells but when this code runs i can still select the locked cells,..

inputWks.Protect wsPwd, DrawingObjects:=False, Contents:=True, Scenarios:= _ 
        False, AllowSorting:=True, AllowFiltering:=True, AllowUsingPivotTables:= _ 
        True 
   historyWks.Protect wsPwd, DrawingObjects:=False, Contents:=True, Scenarios:= _ 
        False, AllowSorting:=True, AllowFiltering:=True, AllowUsingPivotTables:= _ 
        True

can anyone help??

Related:

2 responses

rizvisa1 Posts 4478 Registration date Thursday 28 January 2010 Status Contributor Last seen 5 May 2022 766
18 Aug 2010 à 07:46
record the protection action and see what codes it generate. then use it
thanks..

these are the codes i got from recording the protection... but it doesn seem to record the select locked cells action.....
rizvisa1 Posts 4478 Registration date Thursday 28 January 2010 Status Contributor Last seen 5 May 2022 766
20 Aug 2010 à 08:11
I think thats is triggered by

Activesheet.EnableSelection = xlUnlockedCells

These are three values that you can use
xlNoSelection
xlNoRestrictions
xlUnlockedCells
ok.. thanks rizvisa...... this is the action i was missing.................... thanks a lot.... cheers............