View Single Post
  #1  
Old March 18th, 2004, 08:52 PM
Ron de Bruin
external usenet poster
 
Posts: n/a
Default Protecting selected Worksheets at Once

You can't protect or unprotect in a group.
you have to loop through the sheets to do it

If you know the names of the worksheets? try this

Sub test()
Dim sht As Worksheet
For Each sht In Sheets(Array("Sheet1", "Sheet4"))
sht.Protect Password:="lock"
'sht.Unprotect Password:="lock"
Next sht
End Sub

Or load the selected sheet in a array and loop through that array


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Gunjani" wrote in message
m...
Since 'Protecting Workbook' does not allow the options as 'Protect
Worksheets' how may I select several worksheets (grouping them or
otherwise) and protect them(obviously with same elements)?

Also how can I identify which worksheets I have selected to group?

--
Many Thanks

Gunjani
Morning comes too early and nighttime falls too late
And sometimes all I want to do is wait
The shadow I've been hiding in has fled from me today
-- Dream Theater, "Surrounded"