Forum Discussion

Pam Laidler's avatar
Pam Laidler
Copper Contributor
Oct 05, 2018

PROTECTING CELLS BUT ALLOW COPYING OF ROWS

Hi Gurus

I have a spreadsheet where I have protected the sheet with password, said to allow select locked and also insert rows, but I want users to be able to copy rows and then insert with the formulas being copied but also stay protected.  Is this possible?

 

thanks

Pam

18 Replies

  • Lorenzo Kim's avatar
    Lorenzo Kim
    Bronze Contributor

    visit these sites:

    https://support.office.com/en-us/article/copy-and-paste-in-a-protected-worksheet-139e676e-10a0-443b-bbfe-3dac22cd8476

    https://www.extendoffice.com/documents/excel/4129-excel-protect-sheet-allow-copy.html

     

    another way is in Workbook_open sub - unprotect the sheet
    then in Workbook_BeforeClose sub - protect the sheet

     

    HTH

     

     

    • Pam Laidler's avatar
      Pam Laidler
      Copper Contributor

      Thanks Lorenzo - I've already looked at the first link - so I'll have a look at the second.  P

    • Pam Laidler's avatar
      Pam Laidler
      Copper Contributor

      Hi Lorenzo

      Does this mean you still need to enter the password to allow the unprotect?  As I don't want to allow users to do this. 

      • Lorenzo Kim's avatar
        Lorenzo Kim
        Bronze Contributor

        I am not an expert on this, but I'd use this method in my work.

        try this first on a test file.  Always make a backup of your work.

        if this work after several tests, then give it a go.

         

        press ALT F11

        and in ThisWorkbook module

        place the codes below

         

        Private Sub Workbook_Open()    'change your password to suit
        Sheet1.UnProtect Password:="your password", UserInterFaceOnly:=True 'assuming that Sheet1
        End Sub

        Private Sub Workbook_BeforeClose(Cancel As Boolean)
        Sheet1.Protect Password:="your password", UserInterFaceOnly:=True
        End Sub


         

Resources