Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA code for check boxes in a form
I created a form with 10 check boxes in Excel. The CheckBox name is index 1
to 10. Then, I wrote a For next statement in the VBA code to list the checked CheckBox(s). However, I encounter problem at the below code (the macro will not recognize the "CheckBox(X)"). Why? For X = 1 To 9 If CheckBox(X) = True Then Y = Y + 1 'Array counter ReDim Preserve vArraychoice(0 To Y) vArraychoice(Y) = CheckBox(X).Caption End If Next X Thanks, HK |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA code for check boxes in a form
In a userform?
You could use: if me.controls("Checkbox" & x).value = true then HKS wrote: I created a form with 10 check boxes in Excel. The CheckBox name is index 1 to 10. Then, I wrote a For next statement in the VBA code to list the checked CheckBox(s). However, I encounter problem at the below code (the macro will not recognize the "CheckBox(X)"). Why? For X = 1 To 9 If CheckBox(X) = True Then Y = Y + 1 'Array counter ReDim Preserve vArraychoice(0 To Y) vArraychoice(Y) = CheckBox(X).Caption End If Next X Thanks, HK -- Dave Peterson |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA code for check boxes in a form
Thanks a lot Dave!, it works
"Dave Peterson" wrote: In a userform? You could use: if me.controls("Checkbox" & x).value = true then HKS wrote: I created a form with 10 check boxes in Excel. The CheckBox name is index 1 to 10. Then, I wrote a For next statement in the VBA code to list the checked CheckBox(s). However, I encounter problem at the below code (the macro will not recognize the "CheckBox(X)"). Why? For X = 1 To 9 If CheckBox(X) = True Then Y = Y + 1 'Array counter ReDim Preserve vArraychoice(0 To Y) vArraychoice(Y) = CheckBox(X).Caption End If Next X Thanks, HK -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
VBA for form check boxes | Excel Worksheet Functions | |||
VBA code for the Check Boxes in a form | Excel Discussion (Misc queries) | |||
How do I create a Form with check boxes in Excel | Excel Worksheet Functions | |||
Form Check Boxes an a worksheet | Excel Programming | |||
Can I Group Form Check Boxes? | Excel Programming |