Hi all

I've created a Userform to give an admin user a mini dashboard to manage various workbook properties, including worksheet and workbook protection.

One of the options is for the user to password protect all worksheets, and I thought I could use a ComboBox for the user to select their preferred cell selection option.

So, on the UserForm I have the following:

A textbox to enter a password [tbxWSPW]
A command button to protect the worksheets [cmdWSProtect]
and a ComboBox [cbxCellSelection] to choose one of three cell options - xlNoRestrictions, xlUnlockedCells and xlNoSlection.

The code I'm using is as follows:

Private Sub cmdWSProtect_Click()

    Application.ScreenUpdating = False
    
    Dim ws As Worksheet

    For Each ws In ActiveWorkbook.Worksheets
    
    ws.EnableSelection = cbxCellSelection.Value
    ws.EnableOutlining = True
    ws.Protect Password:=tbxWSPW.Value, _
    userinterfaceonly:=True, _
    DrawingObjects:=True, _
    Contents:=True, _
    Scenarios:=True, _
    AllowFiltering:=True, _
    AllowUsingPivotTables:=True

    Next ws

        Application.ScreenUpdating = True
        
End Sub
But, when I run this I keep getting a Type Mismatch error on the ws.EnableSelection line.

I have two questions:

1. How do I fix the above?
2. If I wanted to control the other properties (for example DrawingObjects, Scenarios etc), could I do this using checkboxes (ie: ticked for True, unticked for False), and how would I code this?

Many thanks everyone
Stephen