+ Reply to Thread
Results 1 to 6 of 6

Protect Sheet Allowing Users to Format Rows/Edit Objects?

Hybrid View

Kristine T. Protect Sheet Allowing Users... 11-16-2009, 01:18 PM
Kristine T. Re: Protect Sheet Allowing... 11-16-2009, 02:26 PM
Kristine T. Re: Protect Sheet Allowing... 11-16-2009, 02:56 PM
Kristine T. Re: Protect Sheet Allowing... 11-16-2009, 03:16 PM
DonkeyOte Re: Protect Sheet Allowing... 11-16-2009, 03:54 PM
Kristine T. Re: Protect Sheet Allowing... 11-16-2009, 04:38 PM
  1. #1
    Registered User
    Join Date
    11-15-2009
    Location
    Palmer, Alaska
    MS-Off Ver
    Excel 2010
    Posts
    69

    Unhappy Protect Sheet Allowing Users to Format Rows/Edit Objects?

    I want my macro to protect my sheet again after it is done to allow editing objects and formatting rows. I am really stuck and have come up with the below, but it isn't working. Please help!


    Sheets("TA Form").Protect Password:="1234", AllowEditObjects:=True, FormattingRows:=True
    Last edited by Kristine T.; 11-16-2009 at 03:17 PM.

  2. #2
    Registered User
    Join Date
    11-15-2009
    Location
    Palmer, Alaska
    MS-Off Ver
    Excel 2010
    Posts
    69

    Re: Protect Sheet Allowing Users to Format Rows/Edit Objects?

    Okay, I made this work. However, when I put in AllowEditingObjects or AllowEdit Objects it doesn't work. Does anyone know how I should write that last bit so it works?

    ActiveSheet.Protect Password:="1234", AllowFormattingRows:=True, AllowSorting:=True

  3. #3
    Registered User
    Join Date
    11-15-2009
    Location
    Palmer, Alaska
    MS-Off Ver
    Excel 2010
    Posts
    69

    Re: Protect Sheet Allowing Users to Format Rows/Edit Objects?

    Okay, I found the below, but I don't know how to encorporate it in my WorkbookAfterPrint (). I have both posted below. My sheet is named "TA Form", so I assume the With Sheet1 should be changed to With Sheets ("TA Form")?

    Private Sub Workbook_Open() 
        With Sheet1 
            .Protect  Password:="", UserInterfaceOnly:=True 
            .EnableOutlining = True 
            .Protect DrawingObjects:=False, Contents:=True, Scenarios:= _ 
            True 
        End With


    Private Sub WorkbookAfterPrint()
        ActiveSheet.Unprotect Password:="1234"
        ThisWorkbook.Worksheets("TA Form").Range("A89").Interior.ColorIndex = 8
        ThisWorkbook.Worksheets("TA Form").Range("A191:A192").Interior.ColorIndex = 8
        ThisWorkbook.Worksheets("TA Form").Range("H89").Interior.ColorIndex = 8
        ThisWorkbook.Worksheets("TA Form").Range("D155").Interior.ColorIndex = 8
        ThisWorkbook.Worksheets("TA Form").Range("U155").Interior.ColorIndex = 8
        ThisWorkbook.Worksheets("TA Form").Range("AA193").Interior.ColorIndex = 8
        ThisWorkbook.Worksheets("TA Form").Range("K155:P155").Interior.ColorIndex = 8
        ThisWorkbook.Worksheets("TA Form").Range("AD155:AH155").Interior.ColorIndex = 8
        ThisWorkbook.Worksheets("TA Form").Range("A162:U162").Interior.ColorIndex = 8
        ThisWorkbook.Worksheets("TA Form").Range("AB162:AH162").Interior.ColorIndex = 8
        ThisWorkbook.Worksheets("TA Form").Range("I199").Interior.ColorIndex = 8
        ActiveSheet.Protect Password:="1234", AllowFormattingRows:=True
    End Sub

  4. #4
    Registered User
    Join Date
    11-15-2009
    Location
    Palmer, Alaska
    MS-Off Ver
    Excel 2010
    Posts
    69

    Talking Re: Protect Sheet Allowing Users to Format Rows/Edit Objects?

    I solved it. Here is the answer....


    Private Sub WorkbookAfterPrint()
        ActiveSheet.Unprotect Password:="1234"
        ThisWorkbook.Worksheets("TA Form").Range("A89").Interior.ColorIndex = 8
        ThisWorkbook.Worksheets("TA Form").Range("A191:A192").Interior.ColorIndex = 8
        ThisWorkbook.Worksheets("TA Form").Range("H89").Interior.ColorIndex = 8
        ThisWorkbook.Worksheets("TA Form").Range("D155").Interior.ColorIndex = 8
        ThisWorkbook.Worksheets("TA Form").Range("U155").Interior.ColorIndex = 8
        ThisWorkbook.Worksheets("TA Form").Range("AA193").Interior.ColorIndex = 8
        ThisWorkbook.Worksheets("TA Form").Range("K155:P155").Interior.ColorIndex = 8
        ThisWorkbook.Worksheets("TA Form").Range("AD155:AH155").Interior.ColorIndex = 8
        ThisWorkbook.Worksheets("TA Form").Range("A162:U162").Interior.ColorIndex = 8
        ThisWorkbook.Worksheets("TA Form").Range("AB162:AH162").Interior.ColorIndex = 8
        ThisWorkbook.Worksheets("TA Form").Range("I199").Interior.ColorIndex = 8
        ActiveSheet.Protect Password:="1234", DrawingObjects:=False, AllowFormattingRows:=True
        End Sub

  5. #5
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Protect Sheet Allowing Users to Format Rows/Edit Objects?

    Thank you for posting your solution.

    If interested you can format all ranges simultaneously:

    ThisWorkbook.Worksheets("TA Form").Range("A89,A191:A192,H89,D155,U155,AA193,K155:P155,AD155:AH155,A162:U162,AB162:AH162,I199").Interior.ColorIndex = 8

  6. #6
    Registered User
    Join Date
    11-15-2009
    Location
    Palmer, Alaska
    MS-Off Ver
    Excel 2010
    Posts
    69

    Re: Protect Sheet Allowing Users to Format Rows/Edit Objects?

    I was wondering about that... thanks!!!

+ 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