+ Reply to Thread
Results 1 to 3 of 3

sheet protection

  1. #1

    sheet protection

    Hi and thanks in advance,
    I have this problem of unprotecting a sheet, allowing for certain
    features and want to protect that with a password again. When I do
    that, I am getting syntax error. Someone please help,

    code:
    Sub Macro4()
    ActiveSheet.Unprotect Password:="hiacsc"

    ActiveSheet.Protect Password:="hiacsc" DrawingObjects:=True, _
    Contents:=True, Scenarios:=True , AllowFormattingCells:=True,
    _
    AllowFormatingColumns:=True, _
    AllowFormattingRows:=True, AllowSorting:=True,
    AllowFiltering:=True
    ActiveSheet.EnableSelection = xlNoRestrictions
    End Sub

    If I omit Password for protecting the sheet it does what I want, but
    when I protect that with Password atrribute, it is giving me syntax
    error.


  2. #2
    Norman Jones
    Guest

    Re: sheet protection

    Hi Nasir,

    Try changing:

    > ActiveSheet.Protect Password:="hiacsc" DrawingObjects:=True, _


    to

    ActiveSheet.Protect Password:="hiacsc", DrawingObjects:=True, _


    Note the comma after "hiacsc"


    ---
    Regards,
    Norman



    <[email protected]> wrote in message
    news:[email protected]...
    > Hi and thanks in advance,
    > I have this problem of unprotecting a sheet, allowing for certain
    > features and want to protect that with a password again. When I do
    > that, I am getting syntax error. Someone please help,
    >
    > code:
    > Sub Macro4()
    > ActiveSheet.Unprotect Password:="hiacsc"
    >
    > ActiveSheet.Protect Password:="hiacsc" DrawingObjects:=True, _
    > Contents:=True, Scenarios:=True , AllowFormattingCells:=True,
    > _
    > AllowFormatingColumns:=True, _
    > AllowFormattingRows:=True, AllowSorting:=True,
    > AllowFiltering:=True
    > ActiveSheet.EnableSelection = xlNoRestrictions
    > End Sub
    >
    > If I omit Password for protecting the sheet it does what I want, but
    > when I protect that with Password atrribute, it is giving me syntax
    > error.
    >




  3. #3
    Ardus Petus
    Guest

    Re: sheet protection

    You forgot a comma right between "hiacsc" and DrawingObjects

    HTH
    --
    AP

    <[email protected]> a écrit dans le message de news:
    [email protected]...
    > Hi and thanks in advance,
    > I have this problem of unprotecting a sheet, allowing for certain
    > features and want to protect that with a password again. When I do
    > that, I am getting syntax error. Someone please help,
    >
    > code:
    > Sub Macro4()
    > ActiveSheet.Unprotect Password:="hiacsc"
    >
    > ActiveSheet.Protect Password:="hiacsc" DrawingObjects:=True, _
    > Contents:=True, Scenarios:=True , AllowFormattingCells:=True,
    > _
    > AllowFormatingColumns:=True, _
    > AllowFormattingRows:=True, AllowSorting:=True,
    > AllowFiltering:=True
    > ActiveSheet.EnableSelection = xlNoRestrictions
    > End Sub
    >
    > If I omit Password for protecting the sheet it does what I want, but
    > when I protect that with Password atrribute, it is giving me syntax
    > error.
    >




+ 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