in reply to password protet excel sheet

It worked for me. In what way is it not working for you?

Replies are listed 'Best First'.
Re^2: password protet excel sheet
by mangrove (Acolyte) on May 11, 2012 at 21:03 UTC

    It never prompts for password to me. Does it for you?.

      No, it doesn't prompt for the password. If you want a password, simply pass it as the only argument to protect. In the code you supplied, you protected the worksheet with a password of 'test123'.

      Update: I may have misunderstood your question but runrig answered nicely.

      When I try to edit any cell, it does not prompt for password, but there is a popup that says something like "this worksheet is protected, you have to unprotect it to edit...". Maybe it depends on version of Excel?
      For my copy of MS Excel 2010 (32-bit) on Windows 7 (64-bit), it works fine. Under this version, to unprotect it, click on "Review" and then click on "Unprotect worksheet". Then it prompts for a password.
        <Thanks for help.>