View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.newusers
Prashanth KR Prashanth KR is offline
external usenet poster
 
Posts: 25
Default How do I protect a number of sheets allowing the user to add a Com


Wow.... this worked wonderful. And this is what I was looking at. Thanks a
lot Gord. Iam totally impressed and saved me a lot of time as I had more than
50 sheets.

My appreciations for your immediate response.
Prashanth KR.



"Gord Dibben" wrote:

Sub Protect()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
With ws
.Protect Password:="Protect", DrawingObjects:=False, Contents:=True
.EnableSelection = xlUnlockedCells
End With
Next ws
End Sub


Gord Dibben MS Excel MVP

On Tue, 21 Aug 2007 09:20:01 -0700, Prashanth KR
wrote:

Hi,

How do I protect a workbook having a number of sheets (around 50) allowing
the user to add a comment. I tried this with the following macro:

Sub Protect()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Protect Password:="Protect"
Next ws
End Sub

But it would not allow me to add a "Comment" in the unprotected cells.
Kindly help me to create a macro so that I can protect all sheets at one shot
and also allow users to add comments in the unprotected cells.

Please also note that Iam very new to VBA.

Your help is much appreciated,
Prashanth KR