Loop through sheet and protect


Posted by Celeste on June 15, 2001 6:21 AM

I have many sheets named consecutively, I can protect one through vba, but I am trying to run a macro to protect all, there can be many or there can be just a few. I am struggling with a loop, how to protect sheet A to LastSheet.



Posted by Ivan F Moala on June 15, 2001 7:38 AM

Try (Untested)

Sub ProtectAllSheets()
Dim Sh as Worksheet

For each Sh in THhisworkbook.Sheets
Sh.protect
Next

End Sub


HTH
Ivan