Excel: Copy all named ranges but first unprotecting all sheets


I have a macro that first unprotects all sheets from sheet3 and the copies the named range that match the sheet with the same name as the ranged sheet and then protects the sheet I am battling to get this to work, It would be appreciated if someone could assist me

 Sub Copy_Comm()
Application.DisplayAlerts = False

Dim i As Long
For i = 3 To Worksheets.Count


     
       Worksheets(i).Unprotect
      
    Next i
    

With Sheets(1)
    .Range("Peter).Copy
    
        Sheets("Peter).Range("A1").PasteSpecial Paste:=xlPasteValues
        End With
        
     Worksheets(i).Protect
   Next i
    

 End Sub 


This question generated 12 answers. To proceed to the answers, click here.

This thread is current as of April 15, 2015.


For more resources for Microsoft Excel