Good day

I have a user form with 2 checkboxes (4&5)

I have checkbox 4 for "AllowSorting"and i need 5 for "AllowCellFormating"

This is what i have so far but ive tried adding allowcellformating but cannot get both to work together


Private Sub cmdProtect_Click()
Dim wSheet As Worksheet
On Error Resume Next
For Each wSheet In Worksheets
If wSheet.ProtectContents = True Then
wSheet.Unprotect Password:=txtPwd.Text
Else
wSheet.Protect Password:=txtPwd.Text, _
AllowSorting:=CheckBox4.Enabled

End If
Next wSheet
If Err <> 0 Then
MsgBox "You have entered an incorrect password. All worksheets could not " & _
"be unprotected.", vbCritical, "Incorrect Password"
End If
On Error GoTo 0
Unload Me
End Sub

How would i add it to this macro to make it work