+ Reply to Thread
Results 1 to 3 of 3

use macro on a protected sheet

  1. #1
    das.s.k
    Guest

    use macro on a protected sheet

    If i protect a worksheet the macro is not executing. it is giving error
    message as
    Run-Time Error 1004
    You cannot use this command in a protected sheet.

    kindly suggest the procedure to execute the macro in a protected sheet. i
    want to protect some cells in the sheet from being uptaion.

  2. #2
    JulieD
    Guest

    Re: use macro on a protected sheet

    Hi

    you'll need to uprotect the sheet at the start of the macro and protect it
    again at the end
    e.g.

    sub mymacro()

    activesheet.unprotect ("pwd")
    'current code

    activesheet.protect ("pwd")
    end sub

    where pwd is your password

    Cheers
    JulieD


    "das.s.k" <das.s.k@discussions.microsoft.com> wrote in message
    news:27FF4012-4082-40FD-9CDE-A26138178E30@microsoft.com...
    > If i protect a worksheet the macro is not executing. it is giving error
    > message as
    > Run-Time Error 1004
    > You cannot use this command in a protected sheet.
    >
    > kindly suggest the procedure to execute the macro in a protected sheet. i
    > want to protect some cells in the sheet from being uptaion.




  3. #3
    Tony
    Guest

    use macro on a protected sheet

    If you are protecting the worksheet from the VBA code you
    might try this:

    Dim x as Boolean

    x = Worhsheets(1).Protect_
    (DrawingObjects:=True, Contents:=True, _
    Scenarios:=True, UserInterfaceOnly:=True)

    The last arg sets the protection so that a macro can alter
    the sheet but a user cannot.

    Hope this helps

    Tony
    >-----Original Message-----
    >If i protect a worksheet the macro is not executing. it

    is giving error
    >message as
    >Run-Time Error 1004
    >You cannot use this command in a protected sheet.
    >
    >kindly suggest the procedure to execute the macro in a

    protected sheet. i
    >want to protect some cells in the sheet from being

    uptaion.
    >.
    >


+ 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.6.0 RC 1