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