How to Lock the data in a cell in excel using vba -
I want to prevent others from editing cell contents in my Excel sheet using VBA. Is it possible to do this?
You can choose which cells you do not want to preserve (user-editing To be eligible) by setting the lock status of false state:
worksheet ("sheet 1"). Range ("B2: C3"). Lock = false
Then, you can protect the sheet, and all other cells will be preserved. To do this, the code is still allowed to modify cells in your VBA code:
worksheet ("sheet 1"). Protect the user interface only: = true
or
call worksheets ("Sheet1"). Defense (User Interface Only: = True)
Comments
Post a Comment