Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I have a sheet which I need to protect:
I have this code (VBA) With ActiveSheet .Protect Password:="xxx" .EnableSelection = xlUnlockedCells End With AND it works great. BUT I need to add to this so they cab use FormatCells, FormatColumns and FormatRows. When I wrote this: With ActiveSheet .Protect Password:="xxx" .EnableSelection = xlUnlockedCells .EnableSelection = xlFormatCells .EnableSelection = xlFormatColumns .EnableSelection = xlFormatRows End With IT DOES NOT WORK. Am I doing the code wrong? |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Yes, you are using the code wrong.
With ActiveSheet .Protect Password:="xxx" .EnableSelection = xlUnlockedCells .Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _ , AllowFormattingCells:=True, AllowFormattingColumns:=True, _ AllowFormattingRows:=True End With Recording a macro whilst protecting the sheet would have shown you the code. Gord Dibben MS Excel MVP On Thu, 24 Sep 2009 13:50:02 -0700, Damian wrote: I have a sheet which I need to protect: I have this code (VBA) With ActiveSheet .Protect Password:="xxx" .EnableSelection = xlUnlockedCells End With AND it works great. BUT I need to add to this so they cab use FormatCells, FormatColumns and FormatRows. When I wrote this: With ActiveSheet .Protect Password:="xxx" .EnableSelection = xlUnlockedCells .EnableSelection = xlFormatCells .EnableSelection = xlFormatColumns .EnableSelection = xlFormatRows End With IT DOES NOT WORK. Am I doing the code wrong? |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Gord,
I cant seem to change the letter"p" in .Protect to a capital "P". It switches back to a lower case every time i change it. I tried everything. and the code does not work it its in lower case. Any idea why its going Loco? Thanks. "Gord Dibben" wrote: Yes, you are using the code wrong. With ActiveSheet .Protect Password:="xxx" .EnableSelection = xlUnlockedCells .Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _ , AllowFormattingCells:=True, AllowFormattingColumns:=True, _ AllowFormattingRows:=True End With Recording a macro whilst protecting the sheet would have shown you the code. Gord Dibben MS Excel MVP On Thu, 24 Sep 2009 13:50:02 -0700, Damian wrote: I have a sheet which I need to protect: I have this code (VBA) With ActiveSheet .Protect Password:="xxx" .EnableSelection = xlUnlockedCells End With AND it works great. BUT I need to add to this so they cab use FormatCells, FormatColumns and FormatRows. When I wrote this: With ActiveSheet .Protect Password:="xxx" .EnableSelection = xlUnlockedCells .EnableSelection = xlFormatCells .EnableSelection = xlFormatColumns .EnableSelection = xlFormatRows End With IT DOES NOT WORK. Am I doing the code wrong? |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
What happens when you copy/paste the code into the module?
On my end I can't get the upper case "P" to change to a lower case unless I rem with an apostrophe. Can't say I have seen this before. Perhaps someone can explain for us. One thing I did notice was that the code I posted did not set the password. This revision does. With ActiveSheet .EnableSelection = xlUnlockedCells .Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _ , AllowFormattingCells:=True, AllowFormattingColumns:=True, _ AllowFormattingRows:=True .Protect Password:="xxx" End With Gord On Fri, 25 Sep 2009 07:48:01 -0700, Damian wrote: Gord, I cant seem to change the letter"p" in .Protect to a capital "P". It switches back to a lower case every time i change it. I tried everything. and the code does not work it its in lower case. Any idea why its going Loco? Thanks. "Gord Dibben" wrote: Yes, you are using the code wrong. With ActiveSheet .Protect Password:="xxx" .EnableSelection = xlUnlockedCells .Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _ , AllowFormattingCells:=True, AllowFormattingColumns:=True, _ AllowFormattingRows:=True End With Recording a macro whilst protecting the sheet would have shown you the code. Gord Dibben MS Excel MVP On Thu, 24 Sep 2009 13:50:02 -0700, Damian wrote: I have a sheet which I need to protect: I have this code (VBA) With ActiveSheet .Protect Password:="xxx" .EnableSelection = xlUnlockedCells End With AND it works great. BUT I need to add to this so they cab use FormatCells, FormatColumns and FormatRows. When I wrote this: With ActiveSheet .Protect Password:="xxx" .EnableSelection = xlUnlockedCells .EnableSelection = xlFormatCells .EnableSelection = xlFormatColumns .EnableSelection = xlFormatRows End With IT DOES NOT WORK. Am I doing the code wrong? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
protecting formulas without protecting sheet so grouping still wor | Excel Discussion (Misc queries) | |||
Question about protecting | New Users to Excel | |||
Question about protecting a formula. | Excel Discussion (Misc queries) | |||
Question about protecting charts | Excel Discussion (Misc queries) | |||
A question about locking or protecting a worksheet | Excel Discussion (Misc queries) |