Archive of Mr Excel Message Board

Back to Controls in Excel archive index
Back to archive home

Checkbox captions
Posted by Joe C on June 28, 2001 2:30 PM
I am trying to write the values of checkboxes captions into a array of strings?
I am using the following.
Can someone figure out what Im doing wrong?Private Sub
CommandButton1_Click()
Dim uc(1 To 30) As String
dm = 1
For Each CheckBox In UserForm1.Controls
If CheckBox = True Then
uc(dm) = CheckBox.Caption
dm = dm + 1
End If
Next CheckBox

Re: Checkbox captions
Posted by Ivan F Moala on June 29, 2001 1:48 AM
Dim uc(1 To 30) As String
Dim dm As Integer
Dim Cbk
dm = 1
For Each Cbk In Me.Controls
If Cbk.Value = True Then
uc(dm) = Cbk.Caption
dm = dm + 1
End If
Next

Re: Checkbox captions
Posted by Joe C on June 29, 2001 6:09 AM
Thanks worked like a charm.

This archive is from the original message board at www.MrExcel.com.
All contents © 1998-2004 MrExcel.com.
Visit our
online store to buy searchable CD's with thousands of VBA and Excel answers.
Microsoft Excel is a registered trademark of the Microsoft Corporation.
MrExcel is a registered trademark of Tickling Keys, Inc.