Results 1 to 2 of 2

Thread: Lock cell after data entry

  1. #1
    Seeker Kelly's Avatar
    Join Date
    Dec 2011
    Location
    Sunnyvale, CA
    Posts
    5
    Articles
    0

    Lock cell after data entry



    Register for a FREE account, and/
    or Log in to avoid these ads!

    I am trying to find a code that will lock the cell after data entry, but not the entire sheet.
    I want people to be able to enter data in empty cells, but not delete or edit completed cells.
    Is there a way to do this?
    I know I can lock the particular cells manually, but I want them to lock automatically.
    Please help!
    Thank you.

  2. #2
    Super Moderator p45cal's Avatar
    Join Date
    Dec 2012
    Posts
    1,356
    Articles
    0
    Excel Version
    365
    First unlock all the cells on the sheet
    then protect the sheet.
    Put this code in the sheet's code module:
    Code:
    Private Sub Worksheet_Change(ByVal Target As Range)
    Me.Protect userinterfaceonly:=True
    For Each cll In Target.Cells
      If Not IsEmpty(cll.Value) Then cll.Locked = True
    Next cll
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •