View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Bob Phillips[_3_] Bob Phillips[_3_] is offline
external usenet poster
 
Posts: 2,420
Default VBA code for the Check Boxes in a form

For X = 1 To 10
If CheckBox(X) = True Then
Y = Y + 1 'Array counter
ReDim Preserve vArrayItem(0 To Y)
vArrayItem(Y) = Controls("CheckBox" & X).Caption
End If
Next X


--
__________________________________
HTH

Bob

"HKS" wrote in message
...
I created 10 checkboxes in the Excel form. The name of the checkboxes are
"CheckBox1...10." Then, I wrote the below For next statement in the VBA to
list the checked checkboxes name, but I encounterred problem, why?

For X = 1 To 10
If CheckBox(X) = True Then
Y = Y + 1 'Array counter
ReDim Preserve vArrayItem(0 To Y)
vArrayItem(Y) = CheckBox(X).Caption
End If
Next X


Thanks in advance
HKS