Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm trying to protect all the cells in a spreadsheet with formulas in
them (don't mind the user seeing the formulas, just don't want him changing them), have done so using the following code (compliments of this group, thanks!): Sub lock_cells() Set mySheets = ActiveWorkbook.Sheets For Each s In mySheets If s.Name < "Information Summary" Then s.Activate ActiveSheet.Unprotect Cells.Locked = False Selection.SpecialCells(xlCellTypeFormulas, 23).Locked =True ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True End If Next s End Sub Problem is, some functionality goes away -- e.g., I have some sheets where I have grouped rows/columns, and once the sheet is protected the user cannot collapse/expand these groups. Also, on a protected sheet the user cannot change any formatting -- can't bold or indent, change column width or font color/size, etc. Is there a way to simply lock only the cells with formulas but still allow the user to do anything else on the sheet(s)? Something like lock the cells without protecting the sheet? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
For the outlining, from help on EnableOutlining
EnableOutlining Property True if outlining symbols are enabled when user-interface-only protection is turned on. Read/write Boolean. Remarks This property applies to each worksheet and isn't saved with the worksheet or session. Example This example enables outlining symbols on a protected worksheet. ActiveSheet.EnableOutlining = True ActiveSheet.Protect contents:=True, userInterfaceOnly:=True -- Regards,Tom Ogilvy "Steve" wrote in message ups.com... I'm trying to protect all the cells in a spreadsheet with formulas in them (don't mind the user seeing the formulas, just don't want him changing them), have done so using the following code (compliments of this group, thanks!): Sub lock_cells() Set mySheets = ActiveWorkbook.Sheets For Each s In mySheets If s.Name < "Information Summary" Then s.Activate ActiveSheet.Unprotect Cells.Locked = False Selection.SpecialCells(xlCellTypeFormulas, 23).Locked =True ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True End If Next s End Sub Problem is, some functionality goes away -- e.g., I have some sheets where I have grouped rows/columns, and once the sheet is protected the user cannot collapse/expand these groups. Also, on a protected sheet the user cannot change any formatting -- can't bold or indent, change column width or font color/size, etc. Is there a way to simply lock only the cells with formulas but still allow the user to do anything else on the sheet(s)? Something like lock the cells without protecting the sheet? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Beautiful, Tom. Thanks.
I suppose as far as being able to do simple format changes (bold an entry, indent a cell, change font color, etc.) I am still out of luck? I've done more searching in this group and it appears that besides the Data Validation option that some have mentioned (and which I do not want to use b/c of its shortcomings), I am stuck with all the other limitations. If anyone knows of other code solutions similar to what Tom just suggested Outlining, I'd much appreciate it. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If you have Excel 2002 or later, you have a lot more options with sheet
protection. Of couse if someone using the workbook will have an older workbook or your version is older, then that doesn't help much. These are some of the options found under worksheet level protection in those newer versions: expression.Protect(Password, DrawingObjects, Contents, Scenarios, UserInterfaceOnly, AllowFormattingCells, AllowFormattingColumns, AllowFormattingRows, AllowInsertingColumns, AllowInsertingRows, AllowInsertingHyperlinks, AllowDeletingColumns, AllowDeletingRows, AllowSorting, AllowFiltering, AllowUsingPivotTables) -- Regards, Tom Ogilvy "Steve" wrote in message oups.com... Beautiful, Tom. Thanks. I suppose as far as being able to do simple format changes (bold an entry, indent a cell, change font color, etc.) I am still out of luck? I've done more searching in this group and it appears that besides the Data Validation option that some have mentioned (and which I do not want to use b/c of its shortcomings), I am stuck with all the other limitations. If anyone knows of other code solutions similar to what Tom just suggested Outlining, I'd much appreciate it. |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks a million! Haven't tried them yet, but if I'm interpreting
correctly it looks like I'll be able to do most if not all that I want. You rock. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Protect Cell Formatting including Conditional Formatting | Excel Discussion (Misc queries) | |||
Protect my formulas! | Excel Worksheet Functions | |||
Protect Formulas | Excel Worksheet Functions | |||
how to protect formulas in a cell | Excel Discussion (Misc queries) | |||
protect formulas | Excel Programming |