On 2002-07-11 12:27, Russell Hauf wrote:
Select the sheets you wanted protected.
Then run this macro:
<pre><font color='#000000'>
<font color='#000080'>Sub</font> ProtectMulti()
<font color='#000080'>Dim</font> wks <font color='#000080'>As</font> Worksheet
<font color='#000080'>Dim</font> arrSheets() <font color='#000080'>As</font> <font color='#000080'>String</font>
<font color='#000080'>Dim</font> intI <font color='#000080'>As</font> Integer, intJ <font color='#000080'>As</font> <font color='#000080'>Integer</font>
<font color='#008000'>' Read the currently selected sheet names</font>
<font color='#008000'>' into an array</font>
<font color='#000080'>For</font> <font color='#000080'>Each</font> wks In ActiveWindow.SelectedSheets
intI = intI + 1
<font color='#000080'>ReDim</font> <font color='#000080'>Preserve</font> arrSheets(intI)
arrSheets(intI) = wks.Name
<font color='#000080'>Next</font> wks
<font color='#008000'>' This part will un-select the sheets so that we can</font>
<font color='#008000'>' protect the ones we want.</font>
<font color='#000080'>For</font> <font color='#000080'>Each</font> wks In ThisWorkbook.Worksheets
wks.Select
<font color='#000080'>Next</font> wks
<font color='#008000'>' Now protect the (previously) selected sheets</font>
<font color='#000080'>For</font> intJ = 1 To intI
ThisWorkbook.Worksheets(arrSheets(intJ)).Protect "MyPass"
<font color='#000080'>Next</font> intJ
<font color='#000080'>End</font> <font color='#000080'>Sub</font>
</font></pre>
It worked for me - it should for you too!
-Russell