VBA code to unprotect

Visitor

Hi 

 

I have a VBA code that converts formulas to values (see below) however the sheet is protected therefor I need to add to my code that will unprotect the sheet and then protect the sheet when completed. Note there is no password on the protection.

 

Sub ConvertToValuesByRangeDetailedReport()
CarryOn = MsgBox("Do you want to lock this report? Once locked the report can not be unlocked.", vbYesNo, "WARNING")
If CarryOn = vbYes Then

With Range("A1:L205")
.Cells.Copy
.Cells.PasteSpecial xlPasteValues
.Cells(1).Select
End With
Application.CutCopyMode = False
End If
End Sub

0 Replies