I would highly recommend that you add Option Explicit as the first line in all your Modules, Userforms, etc.
It is unclear to me just what you want. It is best to state goals, not how you want code done to achieve a goal.
I am guessing that you want some sheet activex textbox controls added to each sheet checked in the userform? I guess if you add the userform checkbox controls dynamically that a class may be needed for running a Sub to take an action on check or uncheck events. But even then, a run by commandbutton would work just as well or better.
If you have just a few sheets, it would be best to just code the checkbox options in to begin with for the userform. You can always iterate by sheet index and hide the unneeded sheets. I don't really see a need for checkboxes for each worksheet. It would be easier to maintain to just use a control like a listbox and use Selection or a checkbox option to make the list. Again, a commandbutton would be best to take action on selections or not.
For sheet activex controls, here is an example to add one to show the concept. Note how it sets a linked cell to hold the true/false values for check or not. In production, one would have to get a list of all checkbox controls and check their topleft cell locations and maybe names to make sure that added or deleted ones do not overlap.
Sub MakeOneActiveXTextBoxAndLink()
Dim c As Range, s As OLEObject
With Worksheets("NY")
Set c = .Range("BA2")
Set s = .OLEObjects.Add(ClassType:="Forms.CheckBox.1", Link:=True, _
DisplayAsIcon:=False, Left:=c.Left, Top:=c.Top, Width:= _
c.Width, Height:=c.Height)
s.LinkedCell = c.Address(external:=True)
End With
End Sub
There are better ways to handle the sheet checkbox issues.
1. Data Validation with True,False list.
2. A sheet selection event, to move a checkbox control there.
3. A sheet selection event to toggle the true/false values.
If you need the userform checkbox class, here is an example. There are many out there. Userform code:
'http://www.mrexcel.com/forum/excel-questions/272752-checkbox-controlsource-visual-basic-applications.htmlDim CheckBoxes() As New Class1
Private Sub UserForm_Initialize()
Dim CCount As Long, c As Control
'place here the code that creates your checkboxes, or elsewhere,
'but surelly before the following procedure
CCount = 0
For Each c In Me.Controls
If TypeOf c Is MSForms.CheckBox Then
CCount = CCount + 1
ReDim Preserve CheckBoxes(1 To CCount)
Set CheckBoxes(CCount).CheckGroup = c
End If
Next c
End Sub
Module:
Option Explicit
Public WithEvents CheckGroup As MSForms.CheckBox
Private Sub CheckGroup_Change()
MsgBox CheckGroup.Value
End Sub