Private
Sub
CommandButton2_Click()
ActiveSheet.Unprotect Password:=
"xxx"
Dim
lR
As
Long
, lC
As
Long
Dim
ctrl
As
Object
lR = 12
lC = 2
For
Each
ctrl
In
Me
.Controls
If
Left(ctrl.Name, 8) =
"CheckBox"
Then
If
ctrl.Value
Then
ActiveSheet.Cells(lR, lC) = ctrl.Caption
lR = lR + 1
If
lR > 28
Then
lR = 12: lC = lC + 2
End
If
End
If
Next
ctrl
ActiveSheet.Protect Password:=
"xxx"
, DrawingObjects:=
True
, Contents:=
True
, Scenarios:=
True
, _
AllowFormattingCells:=
True
, AllowFormattingColumns:=
True
, _
AllowFormattingRows:=
True
Unload
Me
End
Sub