Protect but Allow Edit Ranges in Multiple Sheets
Sheeloo,
Thanks for taking your time to look into this. I really appreciate it.
"Sheeloo" wrote:
I will look into this tonight... unless someone else answers this before
that...
I think you need to set range on all sheets through the loop and then
protect the workbook outside the loop. Also name should be different for each
sheet... you can have a variable say i and append it to the name and
increment by one
"EugeniaP" wrote:
Here's what I came up with, but line 4 is giving me the application-defined
or object-defined error:
Sub protectSheets()
Dim mySheet As Worksheet
For Each mySheet In Worksheets
mySheet.Protection.AllowEditRanges.Add Title:="Range 1",
Range:=Range("D10:D14,D16:D32,D34:D35")
mySheet.Protect Password:="214sg1"
Next mySheet
End Sub
What am I doing wrong?
"Sheeloo" wrote:
To loop through the sheets use;
Sub protectSheets
Dim mySheet As Worksheet
For Each mySheet In Worksheets
' protect your range
' Record a macro for one sheet to get the code to be put here
Next mySheet
End Sub
"EugeniaP" wrote:
Hi, there!
Can anyone please help with a solution to the following problem:
I have 20 similar workbooks with exactly the same worksheets that are just
named differently. For example, Workbook 1 is East Division, and the sheets
are New York, New Jersey, Massachusetts - they are exactly the same sheets.
Workbook 2 is South Division, and the sheets are Florida, Alabama, Kentucky -
again, same sheets as in East Division, etc.
Here is my question. Is it possible to create a macro that would
simultaneously allow users to edit range B1:B32 in each of the sheets AND
protect each of the sheets within a workbook? Would this macro be applicable
to all of the other 19 workbooks.
Please help! I can't imagine having to go into each of the sheets in every
workbook and manually set up "allow user to edit range" and "protect sheet"
modes. It'll take me forever.
Thank you in advance!
E.P.
|