Have a look at this example:-
https://app.box.com/s/apaq7kdx948ln177pazlwuhrfsnwy4hv
Sub Test()
Dim myCBX As CheckBox
Dim wks As Worksheet
Dim rngCB As Range
Dim strCap As String
Dim lCbx As Long
Dim i As Integer
Set wks = ActiveSheet
'''change this range if required
Set rngCB = wks.Range("A1:A10")
'''add caption text, if required
'strCap = "Test"
'lCbx = 1
For Each c In rngCB
With c
Set myCBX = wks.CheckBoxes.Add _
(Top:=.Top, Width:=.Width, _
Height:=.Height, Left:=.Left)
End With
With myCBX
.Display3DShading = True
.Name = "cb"
'''change linked cell offset, if required
''' Offet(rows, columns)
.LinkedCell = c.Offset(0, 1) _
.Address(external:=True)
.Caption = "" 'strCap & lCbx
'''add name of macro to run, if required
' .OnAction = ThisWorkbook.Name _
' & "!mycbxMacro"
'lCbx = lCbx + 1
End With
Next c
End Sub
Private Sub CommandButton3_Click()
Dim c As CheckBox
Dim Ws As Worksheet
Set Ws = ActiveSheet
For Each c In Ws.CheckBoxes
'c.Left = 70
If Not Intersect(c.TopLeftCell, Range("A1:A10")) Is Nothing Then
c.Value = xlOff
End If
Next c
End Sub
.Display3DShading = True
n = n + 1
.Name = "cb" & n
In your first code you have Given each checkbox the same name, because of that when you loop through them (second code) the loop thinks they are all in cell "A1".
I have added a variable "n" to the first code as below and it now seems to work.
Code:.Display3DShading = True n = n + 1 .Name = "cb" & n