Protecting Multiple sheets but allow editing of cell ranges.

JoCook

New Member
Joined
Oct 9, 2015
Messages
14
I all thank you in advance for any help!
I have two questions
First is there some macro that can protect the first 52 sheets but allow the editing of these ranges on each sheet ($B$6:$B$17, $B$19:$B$36, $B$38:$B$54, $G$38:$U$54, $G$19:$U$36, $G$6:$U$17, $G$3)
The second question is a macro that I can use with my other macros that will allow them to operate without being affected by the protection macro? Or if posable have the protection macro just ignore the macros that I have implemented by using the names or something?
Thanks
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
I found something that is very close to what I want but when i tryed to modify it to my sheet i couldnt get it to run I got a "run time error 1004 application-defined object-defined"
this is my macro:

Sub Protect_Code_Exclude()
Dim ws As Worksheet
For Each ws In Worksheets
Select Case ws.CodeName
Case "Sheet2", "Sheet3", "Sheet4", "Sheet5", "Sheet6"
Case Else
ws.Protection.AllowEditRanges.Add Title:="Range1", Range:=Range("g3,B6:B54,G6:U54")
End Select
Next ws
End Sub

When I click Debug this is highlighted:

ws.Protection.AllowEditRanges.Add Title:="Range1", Range:=Range("g3,B6:B54,G6:U54")
 
Upvote 0
For any one interested I Figuerd it out here is what i got

Sub Protect_Code_Exclude()
Dim ws As Worksheet
For Each ws In Worksheets
Select Case ws.CodeName
Case "Sheet6"
Case Else
Range("G3,B6:B17,B19:B36,B38:B54,G38:U54,G19:U36,G6:U17").Select
Range("G6").Activate
ws.Protection.AllowEditRanges.Add Title:="Range1", Range:=Range( _
"G3,B6:B17,B19:B36,B38:B54,G38:U54,G19:U36,G6:U17")
ws.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
, AllowSorting:=True, AllowFiltering:=True, AllowUsingPivotTables:=True
End Select
Next ws
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,237
Messages
6,170,928
Members
452,366
Latest member
TePunaBloke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top