Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
VBA code for the Check Boxes in a form
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 |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
VBA code for the Check Boxes in a form
Using your suggestion, I modified one more line of code too.
if Controls("CheckBox" & X).value = true then Thanks Bob! "Bob Phillips" wrote: 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 |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
VBA code for the Check Boxes in a form
oops missed that bit, sorry but you got it <g
-- __________________________________ HTH Bob "HKS" wrote in message ... Using your suggestion, I modified one more line of code too. if Controls("CheckBox" & X).value = true then Thanks Bob! "Bob Phillips" wrote: 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
copy check boxes (made from form toolbar) | Excel Discussion (Misc queries) | |||
Add tab access to check boxes in a protected Excel sheet form. | Excel Discussion (Misc queries) | |||
How do I create a Form with check boxes in Excel | Excel Worksheet Functions | |||
Enable check box in protected sheet + group check boxes | Excel Discussion (Misc queries) | |||
How do I remove (form) check-boxes from multiple excel fields? | Excel Discussion (Misc queries) |