Sub protect() ActiveWorksheet.Protect Password:="pass", AllowFormattingCells:=True, _ AllowSorting:=True End Sub