I have an Excel worksheet that acts like an application, with form control buttons allowing users to 'navigate' through records. First, Previous, Next & Last cycle appropriately through one of the worksheets records, displaying the values in my 'form' worksheet.
When users are not in Edit or Add Mode, I would like to lock the cells to prevent users from modifying contents.
I tried Range("A1:O24").Locked = True, but I am still able to type new values into the cells.
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.
'ws.Protect userinterfaceonly:=True
in the VBA solution which pretty much locks the user interface and still allows you to edit cells from VBA subs. – user2140173UserInterfaceOnly
property is not saved with the file! Therefore, any macro will run into issue when you open a file - unless you use the Open event to re-set the property! – Peter Albert