Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Is there a way to use vb to not just protect a sheet but to choose specific
items in the "Protect Worksheet" dialogue box. (The, "Allow all users of this worksheet to:" check boxes.) This is 2003 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Do you know about Format / Cells / Protection ?
"excel-chump" wrote: Is there a way to use vb to not just protect a sheet but to choose specific items in the "Protect Worksheet" dialogue box. (The, "Allow all users of this worksheet to:" check boxes.) This is 2003 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Record a macro while you do it manually, to get the code. HTH Otto
"excel-chump" wrote in message ... Is there a way to use vb to not just protect a sheet but to choose specific items in the "Protect Worksheet" dialogue box. (The, "Allow all users of this worksheet to:" check boxes.) This is 2003 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Record a macro when you choose the items you want chosen. You'll see the code.
excel-chump wrote: Is there a way to use vb to not just protect a sheet but to choose specific items in the "Protect Worksheet" dialogue box. (The, "Allow all users of this worksheet to:" check boxes.) This is 2003 -- Dave Peterson |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dave,
So obvious! Thanks. Also a another question: I have this in the worksheet code. '----------------------------------------------------------------- Private Sub Worksheet_Change(ByVal Target As Range) '----------------------------------------------------------------- ActiveSheet.Unprotect Const WS_RANGE As String = "g3:f38" '<=== change to suit On Error GoTo ws_exit: Application.EnableEvents = False If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then With Target Select Case .Value Case "YES": .Interior.ColorIndex = 4 'green Case "NO": .Interior.ColorIndex = 3 'red Case "A1": .Interior.ColorIndex = 12 'dark yellow Case "A2": .Interior.ColorIndex = 6 'yellow Case 0: .Interior.ColorIndex = 19 'blank End Select End With End If ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _ , AllowSorting:=True, AllowFiltering:=True ws_exit: Application.EnableEvents = True End Sub When I set the worksheet as shared it no longer works and I get an error message: "Run-time error '1004': Unprotect method of Worksheet class failed." Are there any suggestions on how to work around that? "Dave Peterson" wrote: Record a macro when you choose the items you want chosen. You'll see the code. excel-chump wrote: Is there a way to use vb to not just protect a sheet but to choose specific items in the "Protect Worksheet" dialogue box. (The, "Allow all users of this worksheet to:" check boxes.) This is 2003 -- Dave Peterson |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You can't change the worksheet protection in a shared workbook.
You'll have to choose--either use protection or use sharing, but not both. excel-chump wrote: Dave, So obvious! Thanks. Also a another question: I have this in the worksheet code. '----------------------------------------------------------------- Private Sub Worksheet_Change(ByVal Target As Range) '----------------------------------------------------------------- ActiveSheet.Unprotect Const WS_RANGE As String = "g3:f38" '<=== change to suit On Error GoTo ws_exit: Application.EnableEvents = False If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then With Target Select Case .Value Case "YES": .Interior.ColorIndex = 4 'green Case "NO": .Interior.ColorIndex = 3 'red Case "A1": .Interior.ColorIndex = 12 'dark yellow Case "A2": .Interior.ColorIndex = 6 'yellow Case 0: .Interior.ColorIndex = 19 'blank End Select End With End If ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _ , AllowSorting:=True, AllowFiltering:=True ws_exit: Application.EnableEvents = True End Sub When I set the worksheet as shared it no longer works and I get an error message: "Run-time error '1004': Unprotect method of Worksheet class failed." Are there any suggestions on how to work around that? "Dave Peterson" wrote: Record a macro when you choose the items you want chosen. You'll see the code. excel-chump wrote: Is there a way to use vb to not just protect a sheet but to choose specific items in the "Protect Worksheet" dialogue box. (The, "Allow all users of this worksheet to:" check boxes.) This is 2003 -- Dave Peterson -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Password Protect Excel Options | Excel Discussion (Misc queries) | |||
Protect selected settings in 'options' | Excel Worksheet Functions | |||
what are my options to protect a sheet? | Excel Discussion (Misc queries) | |||
Protect menu options dimmed | Excel Discussion (Misc queries) | |||
Protect/Unprotect function options | Excel Programming |