View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Alex Simmons Alex Simmons is offline
external usenet poster
 
Posts: 15
Default How to make a particular cell alone as Read-only

On Apr 16, 7:15*am, Annamalai.S
wrote:
All,

* *I need to make programatically some cells in Excel sheet as Read-only,
So, that user should not be allowed to edit the contents of that particular
cells, where as users can edit the other cells in the same sheet.

I'm not intersted in making complete sheet as read-only.

Is there any way i can acheive the above requirements.

Thanks,
S.Annamalai


Try this: I used Sheet1 and D3:D7 as my protected range, yours will be
different. I have added an If clause in case your sheet is already
protected.

Sub ProtectCells()

With Worksheets("Sheet1")
If Sheet1.ProtectContents Then
.Unprotect ("password")
End If
.Cells.Locked = False
.Range("D3:D7").Locked = True
.Protect ("your password here")
End With

End Sub