How to make a particular cell alone as Read-only

A

Annamalai.S

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
 
A

Alex Simmons

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top