I have created a protected worksheet and saved the workbook with vba. Users must be able to sort the worksheet but, I don't want them to be able to change content in the locked cells (autofilter works). I have recorded the vba to "Allow Edit Ranges" and added to my code. It appears I have left something out...
I would appreciate any suggestions on how to correct the code. The code below is what I recorded that does not work:
ActiveSheet.Protection.AllowEditRanges.Add Title:="Autosort", Range:=Range( _"A1:U8000")
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
, AllowFormattingRows:=True, AllowSorting:=True, AllowFiltering:=True
This code will produce the desired workbook with protection on the worksheet but, the user can not sort. How do I modify this code to allow sorting?
ActiveSheet.Protect Password:="Winter2018", DrawingObjects:=False, Contents:=True, Scenarios:=True _
, AllowFormattingRows:=True, AllowSorting:=True, AllowFiltering:=True
ActiveSheet.EnableSelection = xlNoRestrictions
Thank you.
I would appreciate any suggestions on how to correct the code. The code below is what I recorded that does not work:
ActiveSheet.Protection.AllowEditRanges.Add Title:="Autosort", Range:=Range( _"A1:U8000")
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
, AllowFormattingRows:=True, AllowSorting:=True, AllowFiltering:=True
This code will produce the desired workbook with protection on the worksheet but, the user can not sort. How do I modify this code to allow sorting?
ActiveSheet.Protect Password:="Winter2018", DrawingObjects:=False, Contents:=True, Scenarios:=True _
, AllowFormattingRows:=True, AllowSorting:=True, AllowFiltering:=True
ActiveSheet.EnableSelection = xlNoRestrictions
Thank you.