+ Reply to Thread
Results 1 to 4 of 4

Code to Protect Sheet Allowing Format Rows & Edit Objects

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

    Code to Protect Sheet Allowing Format Rows & Edit Objects

    When my form protects my spreadsheet after hitting the command button, it doesn't keep my protection settings. I need to allow users to format rows and edit objects. I searched online came up with adding to the last line below, but it isn't working. Please help!



    Private Sub UpdateRatesCommandButton_Click()
    Sheets("TA Form").Unprotect Password:="XXXX"
    Worksheets("TA Form").Range("AV267").Value = AutomobileTextBox.Text
    Worksheets("TA Form").Range("AV268").Value = AircraftTextBox.Text
    Worksheets("TA Form").Range("AV269").Value = MovesTextBox.Text
    Worksheets("TA Form").Range("AV270").Value = AllOthersTextBox.Text
    Unload VehicleRatesUserForm
    Sheets("TA Form").Protect Password:="XXXX", AllowEditObjects:=True, FormattingRows:=True
    End Sub
    Last edited by Kristine T.; 11-15-2009 at 08:44 PM.

  2. #2
    Registered User
    Join Date
    11-24-2009
    Location
    New Zealand
    MS-Off Ver
    Excel 2003, Excel 2007
    Posts
    6

    Re: Code to Protect Sheet Allowing Format Rows & Edit Objects

    ^^ Hi, unfortunately I haven't got an answer for you, I have a similar problem!

    I have a sheet that I am trying to protect parts of but allow a completely user editable range. When it runs, however, it locks the whole sheet.
    I have seen people using ".Protect AllowEditObjects" but for some reason my Excel doesn't recognise this as a valid command - do I not have a library turned on somewhere?

    Any / All help appreciated.
    Writing in Excel 2007 but have to save in compatibility format for my users.


    Please Login or Register  to view this content.
    Last edited by gec; 11-24-2009 at 10:16 PM.

  3. #3
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,480

    Re: Code to Protect Sheet Allowing Format Rows & Edit Objects

    usually you cannot format cells in a protect sheet

  4. #4
    Registered User
    Join Date
    11-24-2009
    Location
    New Zealand
    MS-Off Ver
    Excel 2003, Excel 2007
    Posts
    6

    Re: Code to Protect Sheet Allowing Format Rows & Edit Objects

    I answered my own question here. My code wasn't allowing for the selection of unlocked cells, so even though they were unlocked Excel didn't know it.

    I inserted an extra line (below) and it seems to have helped.

    Please Login or Register  to view this content.
    hopefully this may be of use to someone else?
    Last edited by gec; 11-24-2009 at 11:48 PM. Reason: Changed default font in code area so bold text shows up easier

+ 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