+ Reply to Thread
Results 1 to 2 of 2

Macro protected work sheet

Hybrid View

  1. #1
    Henry
    Guest

    Macro protected work sheet

    Hi All,

    I've use macro to protect the sheet with the group function work, as follow:

    Sub Auto_Open()
    With Worksheets("Sheet1")
    .Protect Password:="hi", userinterfaceonly:=True
    .EnableOutlining = True
    End With
    End Sub

    It works fine, but i would like to enable the hide/unhide and insert/delete
    rows & columns function. ie, the "Protect Sheet" dialog box should be all
    checked instead of "Select locked cells" and "Select unlocked cells" be
    checked only. How can i do that except manually unprotect the sheet and
    protect it back again?

    Also, could this macro runs on multiple sheet? if i create a copy of sheet1
    could it works on "sheet1 (2)" automatically?

    Seems i asked too much...but thanks for your help!!

  2. #2
    Doug Glancy
    Guest

    Re: Macro protected work sheet

    Henry,

    I turned on the Macro Recorder, protected a sheet and checked all the boxes.
    This is what I got:

    ActiveSheet.Protect DrawingObjects:=False, Contents:=True, Scenarios:= _
    False, AllowFormattingCells:=True, AllowFormattingColumns:=True, _
    AllowFormattingRows:=True, AllowInsertingColumns:=True,
    AllowInsertingRows _
    :=True, AllowInsertingHyperlinks:=True, AllowDeletingColumns:=True,
    _
    AllowDeletingRows:=True, AllowSorting:=True, AllowFiltering:=True, _
    AllowUsingPivotTables:=True

    I'm 99.9% sure that the protection will copy over if you make a copy of the
    sheet after you do this. I guess you'll know for sure when you try it!

    hth,

    Doug

    "Henry" <[email protected]> wrote in message
    news:[email protected]...
    > Hi All,
    >
    > I've use macro to protect the sheet with the group function work, as

    follow:
    >
    > Sub Auto_Open()
    > With Worksheets("Sheet1")
    > .Protect Password:="hi", userinterfaceonly:=True
    > .EnableOutlining = True
    > End With
    > End Sub
    >
    > It works fine, but i would like to enable the hide/unhide and

    insert/delete
    > rows & columns function. ie, the "Protect Sheet" dialog box should be all
    > checked instead of "Select locked cells" and "Select unlocked cells" be
    > checked only. How can i do that except manually unprotect the sheet and
    > protect it back again?
    >
    > Also, could this macro runs on multiple sheet? if i create a copy of

    sheet1
    > could it works on "sheet1 (2)" automatically?
    >
    > Seems i asked too much...but thanks for your help!!




+ 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