Protect spreadshet, but allow user edit range
I would like to protect my spreadsheet, but allow user a edit range.
I used following code: Sheets(wsDestination).Select ActiveSheet.Protection.AllowEditRanges(1).Delete ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True ActiveSheet.Protection.AllowEditRanges.Add Title:=wsDestination & " Range ", Range:=Range("G12:Q20") If I have "ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True" first then the code failed on the last line. It makes sense, because the spreadsheet already protected. When I tried last line first, it protects all the spreadsheet. If I do not uses "ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True" code, then the whole spreadsheet does not protect at all. Are there anything wrong I did? Any information is great appreciated, |
Protect spreadshet, but allow user edit range
This works for me:
ActiveSheet.Protection.AllowEditRanges(1).Delete ActiveSheet.Protection.AllowEditRanges.Add Title:=wsDestination _ & " Range", Range:=Range("D3:H12") ActiveSheet.Protect DrawingObjects:=True, Contents:=True _ , Scenarios:=True What is the value of wsDestination? Regards Rowan "Souris" wrote: I would like to protect my spreadsheet, but allow user a edit range. I used following code: Sheets(wsDestination).Select ActiveSheet.Protection.AllowEditRanges(1).Delete ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True ActiveSheet.Protection.AllowEditRanges.Add Title:=wsDestination & " Range ", Range:=Range("G12:Q20") If I have "ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True" first then the code failed on the last line. It makes sense, because the spreadsheet already protected. When I tried last line first, it protects all the spreadsheet. If I do not uses "ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True" code, then the whole spreadsheet does not protect at all. Are there anything wrong I did? Any information is great appreciated, |
Protect spreadshet, but allow user edit range
Thanks it works now,
Thanks millions, "Rowan" wrote: This works for me: ActiveSheet.Protection.AllowEditRanges(1).Delete ActiveSheet.Protection.AllowEditRanges.Add Title:=wsDestination _ & " Range", Range:=Range("D3:H12") ActiveSheet.Protect DrawingObjects:=True, Contents:=True _ , Scenarios:=True What is the value of wsDestination? Regards Rowan "Souris" wrote: I would like to protect my spreadsheet, but allow user a edit range. I used following code: Sheets(wsDestination).Select ActiveSheet.Protection.AllowEditRanges(1).Delete ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True ActiveSheet.Protection.AllowEditRanges.Add Title:=wsDestination & " Range ", Range:=Range("G12:Q20") If I have "ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True" first then the code failed on the last line. It makes sense, because the spreadsheet already protected. When I tried last line first, it protects all the spreadsheet. If I do not uses "ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True" code, then the whole spreadsheet does not protect at all. Are there anything wrong I did? Any information is great appreciated, |
All times are GMT +1. The time now is 07:31 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com