title: Allow user to input certain value in locked cells
body: <p>I am currently working with two pieces of vba code. I am trying to marry them together to achieve the below purpose. </p>
  
  <p><strong>First code</strong></p>
  
  <p>I have code that allows users to double click on a cell and then it time stamps the cell, and subsequently locks the  relevant cell.  Which works fine. However is some instances the user will have to <strong>type in NA</strong> and different piece of code will run ( Second code).</p>
  
  <pre><code>Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
  
      Application.EnableEvents = False
  
      With Target
          If .Column = 4 Then
              Select Case .Row
                  Case 20, 24, 25, 27, 28, 30, 31, 32, 33, 34, 35, 37, 38, 40, 42, 43, 44, 54, 55, 56, 58, 59, 61, 62, 63, 64, 65
                  Sheets("Sheet3").Protect Password:="Test", userinterfaceonly:=True
                      .Value2 = "Prepared By" &amp; "  " &amp; Environ("Username")
                      .Value2 = .Value2 &amp; "  " &amp; Format(Now, "yyyy-MM-dd hh:mm:ss")
                       .Locked = True
                      End Select
                   End If
      End With
  End Sub
  </code></pre>
  
  <p><strong>Second Code when user Types NA</strong></p>
  
  <pre><code>Private Sub Worksheet_Change(ByVal Target As Excel.Range)
      '// Check if the target row number is in our array:
      Select Case Target.Row
          Case 20, 24, 25, 27, 28, 30, 31, 32, 33, 34, 35, 37, 38, 40, 42, 43, 44, 54, 55, 56, 58, 59, 61, 62, 63, 64, 65
              ' Do Something
              If CStr(Target.Value) Like "*NA*" Then
  
                  Target.Value = "Not applicable" &amp; "  " &amp; Environ("Username") &amp; "  " &amp; Format(Now, "yyyy-MM-dd hh:mm:ss")
  
              End If
  
          Case Else
              ' Do nothing
              Exit Sub
      End Select
  End Sub
  </code></pre>
  
  <p><strong>Problem to Overcome</strong></p>
  
  <p>Once the user double clicks on a the cell and it locks , there are not able to later change that cell to NA. NA should be the only value that the user should be able to type once cell is locked.</p>
  
  <p><strong>Question</strong></p>
  
  <p>Is there a way that i can allow the user to type in NA only once the cell is locked. Therefore user only has  two options to type <strong>na or Double click</strong></p>