ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to delete allowEditRanges programatically (https://www.excelbanter.com/excel-programming/370000-how-delete-alloweditranges-programatically.html)

Sri Ram[_2_]

How to delete allowEditRanges programatically
 
I am using the AllowEdit Option in a worksheet for making some rows editable.
I am giving the range starting from Column 'A' to Column 'IV'. Now I am using
a logic for clearing the alloweditranges created previously which is given
below:

Set oSheet = ActiveWorkbook.Sheets("Sheet1")
iRangeCount = oSheet.Protection.AllowEditRanges.Count
oSheet.Unprotect

For iIndex = 0 To iRangeCount
oSheet.Protection.AllowEditRanges(iIndex).Delete
Next

This logic works without any error but the allowEditRanges Count remains the
same. In the WorkSheet the ranges which were given allowedit previously
remains as given. I want to know whether there is any solution for clearing
the ranges given for allowedits programatically.



All times are GMT +1. The time now is 12:25 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com