![]() |
Protection
Is there a way to programatically protect all the formulas
in a multiple sheet file, and also not allow row insertions or deletions? TIA |
Protection
For Each Wks In Application.Workbooks(1).Worksheets
Wks.Protect "optionalpassword" Next Application.Workbooks(1).Protect "optionalpassword" Note that cells need to be locked (which they are by default) for protection to do anything about changing or hiding forumulas. "Eva Shanley" wrote: Is there a way to programatically protect all the formulas in a multiple sheet file, and also not allow row insertions or deletions? TIA |
Protection
for each sh in ActiveWorkbook.Worksheets
sh.Activate set rng = nothing if sh.Protectcontents then sh.Unprotect password:="ABCD" end if On error resume next set rng = sh.SpecialCells(xlFormulas) On error goto 0 if not rng is nothing then _ rng.locked = True sh.Protect Password:="ABCD" Next -- Regards, Tom Ogilvy "Eva Shanley" wrote in message ... Is there a way to programatically protect all the formulas in a multiple sheet file, and also not allow row insertions or deletions? TIA |
Protection
So I still need to unprotect the range a user can key into
first, correct? -----Original Message----- for each sh in ActiveWorkbook.Worksheets sh.Activate set rng = nothing if sh.Protectcontents then sh.Unprotect password:="ABCD" end if On error resume next set rng = sh.SpecialCells(xlFormulas) On error goto 0 if not rng is nothing then _ rng.locked = True sh.Protect Password:="ABCD" Next -- Regards, Tom Ogilvy "Eva Shanley" wrote in message ... Is there a way to programatically protect all the formulas in a multiple sheet file, and also not allow row insertions or deletions? TIA . |
Protection
Unlock, not unprotect.
but the sheet can't be protected when you unlock the cells. -- Regards, Tom Ogilvy "Eva Shanley" wrote in message ... So I still need to unprotect the range a user can key into first, correct? -----Original Message----- for each sh in ActiveWorkbook.Worksheets sh.Activate set rng = nothing if sh.Protectcontents then sh.Unprotect password:="ABCD" end if On error resume next set rng = sh.SpecialCells(xlFormulas) On error goto 0 if not rng is nothing then _ rng.locked = True sh.Protect Password:="ABCD" Next -- Regards, Tom Ogilvy "Eva Shanley" wrote in message ... Is there a way to programatically protect all the formulas in a multiple sheet file, and also not allow row insertions or deletions? TIA . |
All times are GMT +1. The time now is 10:20 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com