title: Run-time error '1004' Unable to set the NumberFormat property of Range Class
body: <p>I installed a very simple command button to timestamp a selected cell. The command button works completely fine until I protect the sheet, then it throws the error mentioned in the title. I have already checked that the cells' format is not selected to 'locked'.</p>
  
  <pre><code>Private Sub CommandButton1_Click()
  Dim ts As Date
  
  With Selection
  
  .Value = Now
  
  .NumberFormat = "h:mm AM/PM"
  
  End With
  End Sub
  </code></pre>