CB.WorksheetProtection Example 1

This example activates the target worksheet, passes the password "passwd," runs a simulation, and resets Crystal Ball .

Sub WorksheetProtectionExample1()
   ' The following call activates the target worksheet
   ThisWorkbook.Worksheets("Sheet3").Activate

   ' The following call passes current password to Crystal Ball 
   CB.WorksheetProtection "passwd", True

   ' The following calls run and reset the simulation
   CB.Simulation 1000
   CB.ResetND
End Sub

Note:

To apply protection to worksheets that do not have a password, use this:

CB.WorksheetProtection "", True