+ Reply to Thread
Results 1 to 5 of 5

Macro and Protected Sheet Problem

  1. #1
    Daniel R. Young
    Guest

    Macro and Protected Sheet Problem

    I have macros that hide rows and I want to protect my sheet so individuals
    will not be able to change any of the information. When the sheet is
    protected the macro will not work. It goes to a debuger.

    Is there a way to run my macros even though the sheet is protected?

    Thank you,

    Daniel

  2. #2
    K Dales
    Guest

    RE: Macro and Protected Sheet Problem

    Just turn protection off temporarily for the sheet:
    Sub YourMacro()
    Worksheets("SheetName").Unprotect
    ' macro code here
    Worksheets("SheetName").Protect
    End Sub
    --
    - K Dales


    "Daniel R. Young" wrote:

    > I have macros that hide rows and I want to protect my sheet so individuals
    > will not be able to change any of the information. When the sheet is
    > protected the macro will not work. It goes to a debuger.
    >
    > Is there a way to run my macros even though the sheet is protected?
    >
    > Thank you,
    >
    > Daniel


  3. #3
    Otto Moehrbach
    Guest

    Re: Macro and Protected Sheet Problem

    In your macro, unprotect the sheet, hide the rows, protect the sheet. HTH
    Otto
    "Daniel R. Young" <[email protected]> wrote in message
    news:[email protected]...
    >I have macros that hide rows and I want to protect my sheet so individuals
    > will not be able to change any of the information. When the sheet is
    > protected the macro will not work. It goes to a debuger.
    >
    > Is there a way to run my macros even though the sheet is protected?
    >
    > Thank you,
    >
    > Daniel




  4. #4
    STEVE BELL
    Guest

    Re: Macro and Protected Sheet Problem

    Daniel,

    There is an alternative - check out the below code...
    =======================================
    Select UnProtected Cells ONLY
    This will prevent users from clicking on protected cells on all
    worksheets. Therefore, the warning message will not appear. The code
    must be enterred in the ThisWorkbook module.

    Note that the EnableSelection property must be reset each time the
    workbook is opened as it defaults to xlNoRestrictions. The
    worksheet(s)
    must first be unprotected to set the EnableSelection property and then
    must be protected for it to take effect.

    Private Sub Workbook_Open()
    Dim WS As Worksheet
    For Each WS In ThisWorkbook.Worksheets
    WS.Unprotect 'Password:="wxyz"
    WS.EnableSelection = xlUnlockedCells
    WS.Protect 'Password:="wxyz", UserInterfaceOnly:=True
    Next
    End Sub

    Regards,
    Greg Wilson 5/3/03


    --
    steveB

    Remove "AYN" from email to respond
    "Otto Moehrbach" <[email protected]> wrote in message
    news:%[email protected]...
    > In your macro, unprotect the sheet, hide the rows, protect the sheet.
    > HTH Otto
    > "Daniel R. Young" <[email protected]> wrote in
    > message news:[email protected]...
    >>I have macros that hide rows and I want to protect my sheet so individuals
    >> will not be able to change any of the information. When the sheet is
    >> protected the macro will not work. It goes to a debuger.
    >>
    >> Is there a way to run my macros even though the sheet is protected?
    >>
    >> Thank you,
    >>
    >> Daniel

    >
    >




  5. #5
    Daniel R. Young
    Guest

    RE: Macro and Protected Sheet Problem

    It worked thank you!

    "Daniel R. Young" wrote:

    > I have macros that hide rows and I want to protect my sheet so individuals
    > will not be able to change any of the information. When the sheet is
    > protected the macro will not work. It goes to a debuger.
    >
    > Is there a way to run my macros even though the sheet is protected?
    >
    > Thank you,
    >
    > Daniel


+ 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