• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Allow specific cells to be editable in excel 16.

Netsy

New Member
hi,
In an excel sheet, when workbook is opened, how can I locked all cells except those to be input.
Input to be done only in cells
C3, C4,C7:E7, C9,C11,C13,C15:E17
excel attached.

header or other text should not be editable as well as others cell.
 

Attachments

  • lockcells.xlsx
    18 KB · Views: 1
Select the cells where input is required and set their format (Protection tab) to unlocked. Now protect the worksheet (review ribbon) and only those cells will be editable.
 
Try this in the Thisworkbook code-module (you will probably change what sheet it refers to):
Code:
Private Sub Workbook_Open()
With Sheets("Sheet1")
  .Protect userinterfaceonly:=True
  .Cells.Locked = True
  .Range("C3, C4,C7:E7, C9,C11,C13,C15:E17").Locked = False
  .EnableSelection = xlUnlockedCells
End With
End Sub
 
Back
Top