Protecting cells in Excel but allow these to be modified by VBA script

Try using

Worksheet.Protect "Password", UserInterfaceOnly := True

If the UserInterfaceOnly parameter is set to true, VBA code can modify protected cells.

Note however that this parameter does not stick. It needs to be reapplied each time the file is opened.

Leave a Comment