DISREGARD
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:

ActiveSheet.Unprotect
        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

Um.....help?

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.