EDIT: found an answer.


Trying to unprotect a protected worksheet, write to a cell and protect it again. The following code works ok if the workbook is not shared:

        Range("D18").Value = 1
        ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True

However, when the workbook is shared for network use this results in the error:

Run-time error '1004':

Unprotect method of Worksheet class failed


AndreRet commented: For solving your problem, keep it up! +6

Nice in solving your own problem, keep it up.:)

Please mark this as solved, thanks.