>the code was in a subroutine, the error was : Run-time error '1004' :
Application-defined or Object-defined error.
> It is not that it doesn't work - it doesn't compile. Please always
provide in your message whatever error information the compiler or
Excel has given you.
>
> Where did you get this code from? Go back and have another look.
Or check the help on the Protect method. These items you have the :=
and commas with are parameters of a protect call, not individual
statements.