+ Reply to Thread
Results 1 to 3 of 3

Protect spreadshet, but allow user edit range

Hybrid View

  1. #1
    Souris
    Guest

    Protect spreadshet, but allow user edit range

    I would like to protect my spreadsheet, but allow user a edit range.

    I used following code:

    Sheets(wsDestination).Select
    ActiveSheet.Protection.AllowEditRanges(1).Delete
    ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
    ActiveSheet.Protection.AllowEditRanges.Add Title:=wsDestination & " Range
    ", Range:=Range("G12:Q20")

    If I have "ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
    Scenarios:=True" first then the code failed on the last line. It makes sense,
    because the spreadsheet already protected.

    When I tried last line first, it protects all the spreadsheet.
    If I do not uses "ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
    Scenarios:=True" code, then the whole spreadsheet does not protect at all.

    Are there anything wrong I did?

    Any information is great appreciated,

  2. #2
    Rowan
    Guest

    RE: Protect spreadshet, but allow user edit range

    This works for me:

    ActiveSheet.Protection.AllowEditRanges(1).Delete
    ActiveSheet.Protection.AllowEditRanges.Add Title:=wsDestination _
    & " Range", Range:=Range("D3:H12")
    ActiveSheet.Protect DrawingObjects:=True, Contents:=True _
    , Scenarios:=True

    What is the value of wsDestination?

    Regards
    Rowan

    "Souris" wrote:

    > I would like to protect my spreadsheet, but allow user a edit range.
    >
    > I used following code:
    >
    > Sheets(wsDestination).Select
    > ActiveSheet.Protection.AllowEditRanges(1).Delete
    > ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
    > ActiveSheet.Protection.AllowEditRanges.Add Title:=wsDestination & " Range
    > ", Range:=Range("G12:Q20")
    >
    > If I have "ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
    > Scenarios:=True" first then the code failed on the last line. It makes sense,
    > because the spreadsheet already protected.
    >
    > When I tried last line first, it protects all the spreadsheet.
    > If I do not uses "ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
    > Scenarios:=True" code, then the whole spreadsheet does not protect at all.
    >
    > Are there anything wrong I did?
    >
    > Any information is great appreciated,


  3. #3
    Souris
    Guest

    RE: Protect spreadshet, but allow user edit range

    Thanks it works now,

    Thanks millions,

    "Rowan" wrote:

    > This works for me:
    >
    > ActiveSheet.Protection.AllowEditRanges(1).Delete
    > ActiveSheet.Protection.AllowEditRanges.Add Title:=wsDestination _
    > & " Range", Range:=Range("D3:H12")
    > ActiveSheet.Protect DrawingObjects:=True, Contents:=True _
    > , Scenarios:=True
    >
    > What is the value of wsDestination?
    >
    > Regards
    > Rowan
    >
    > "Souris" wrote:
    >
    > > I would like to protect my spreadsheet, but allow user a edit range.
    > >
    > > I used following code:
    > >
    > > Sheets(wsDestination).Select
    > > ActiveSheet.Protection.AllowEditRanges(1).Delete
    > > ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
    > > ActiveSheet.Protection.AllowEditRanges.Add Title:=wsDestination & " Range
    > > ", Range:=Range("G12:Q20")
    > >
    > > If I have "ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
    > > Scenarios:=True" first then the code failed on the last line. It makes sense,
    > > because the spreadsheet already protected.
    > >
    > > When I tried last line first, it protects all the spreadsheet.
    > > If I do not uses "ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
    > > Scenarios:=True" code, then the whole spreadsheet does not protect at all.
    > >
    > > Are there anything wrong I did?
    > >
    > > Any information is great appreciated,


+ 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