as I try to create a check box array for for-loop using but I've got error 91, can any one can give me some suggestion to solve this? thx for help
Sub checkBoxSet()
Dim activeSheet As Worksheet
Set activeSheet = ActiveWorkbook.activeSheet
Dim control(1 To 5) As CheckBox
control(1) = Sheet1.CheckBox1 'star error 91 here
control(2) = Sheet1.CheckBox2
control(3) = Sheet1.CheckBox3
control(4) = Sheet1.CheckBox4
control(5) = Sheet1.CheckBox5
For i = LBound(control) To UBound(control)
' copy the old sheet checkbox to new sheet
activeSheet.CheckBoxes.Add(control(i).Left, control(i).Top, control(i).Width, control(i).Height).Select
With Selection
.Caption = ""
.Value = xlOff
.LinkedCell = "C" & ToRow
.Display3DShading = False
End With
Next i
End Sub
[update : 5/3/2016 23:05 HKT] pls accept me forgot to provide the background about this code, as here, it have two excel file, call temp.xlsm and month.xls, as the temp will copy a part of data to month.xls, also this part is about copy the checkbox to the month.xls, in temp.xlsm, it have 5 sheet, and the sheet1 is code name of the main sheet .