I'm having a problem with running some code on a protected sheet. The code in question handles the data validation for particular cells when they are selected. I initially got run-time errors because the macros were protected, so I used the worksheet.protect method and the UserInterfaceOnly argument:
[vba]Sheets("7. Equip Schedule").Protect "password", userinterfaceonly:=True[/vba]
This did not work at first, but I then learned that data validation uses drawing objects, so I tried:
[vba]
Sheets("7. Equip Schedule").Protect "password", userinterfaceonly:=True, DrawingObjects:=False[/vba]
This worked, sort of. My code runs properly and updates cell data validation as desired. However, despite the sheet being protected, cells which are locked are still editable by the user. So it's essentially not protected. I tried:
[vba]
Sheets("7. Equip Schedule").Protect "password", Contents:= True, userinterfaceonly:=True, DrawingObjects:=False[/vba]
This fixes the protection of locked cells but the run-time errors return.
Has anyone experienced a similar issue? Any suggestions?
Thanks.