Mega Code Archive
Protects the myWorksheet worksheet with the same password but allows the formatting of cells and allows the sorting of unlocked cell
Sub protect()
ActiveWorksheet.Protect Password:="pass", AllowFormattingCells:=True, _
AllowSorting:=True
End Sub