+ Reply to Thread
Results 1 to 2 of 2

Thread: Add protect worksheet password in macro

  1. #1
    Kelly
    Guest

    Add protect worksheet password in macro

    I created 43 sets of workbooks that need to be locked and protected from end
    users. I have created a macro that will clear the previos days numbers and
    copies on cell to another which are both locked. My macro won't run with
    those two cells being locked. I tried to create a macro that unprotects the
    worksheet, does all actions needed then protects the worksheet again. When I
    run the macro the first thing that pops up is the password entry box. It
    didn't put the password I entered in the code. Can I add the password to it
    and if so how? I'm new at writing macros and code in Excell.
    --
    Thank you, Kelly

  2. #2
    Paul B
    Guest

    Re: Add protect worksheet password in macro

    Kelly, here is one way,

    Const PW As String = "123" 'Change Password Here
    ActiveSheet.Unprotect Password:=PW
    'you code here
    ActiveSheet.Protect Password:=PW


    --
    Paul B
    Always backup your data before trying something new
    Please post any response to the newsgroups so others can benefit from it
    Feedback on answers is always appreciated!
    Using Excel 2002 & 2003

    "Kelly" <Kelly@discussions.microsoft.com> wrote in message
    news:9164BC6F-41B7-4019-8F83-B155BEE88662@microsoft.com...
    > I created 43 sets of workbooks that need to be locked and protected from

    end
    > users. I have created a macro that will clear the previos days numbers

    and
    > copies on cell to another which are both locked. My macro won't run with
    > those two cells being locked. I tried to create a macro that unprotects

    the
    > worksheet, does all actions needed then protects the worksheet again.

    When I
    > run the macro the first thing that pops up is the password entry box. It
    > didn't put the password I entered in the code. Can I add the password to

    it
    > and if so how? I'm new at writing macros and code in Excell.
    > --
    > Thank you, Kelly




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.2.0