title: How to lock Excel cells in VBA?
body: <p>I have an Excel worksheet that acts like an application, with form control buttons allowing users to 'navigate' through records. First, Previous, Next &amp; Last cycle appropriately through one of the worksheets records, displaying the values in my 'form' worksheet.</p>
  
  <p>When users are not in Edit or Add Mode, I would like to lock the cells to prevent users from modifying contents.</p>
  
  <p>I tried Range("A1:O24").Locked = True, but I am still able to type new values into the cells.</p>
  
  <p>Anyone know how to accomplish this? I need my vba code to be able to assign new values to the cells as users 'navigate', but to prevent users from entering new values unless in Add or Edit mode.</p>