series of Checkboxes to select worksheet's data

  • Thread starter Thread starter brucelim80
  • Start date Start date
B

brucelim80

hi,

Can anyone help me with this problem?

I have a series of checkboxes on one form which allow user to select
any mixture of checkbox and click on the generate button to transfer
the selected worksheet's data on to a consolidated worksheet.


How do i write a code to extract the series of checkboxes selected and
perform certain action.

Thank you,

Regards,
Bruce
 
Bruce,

Here is how to test all the checkboxes, assuming that it is Forms toolbar
checkboxes

Sub Macro1()
Dim cb As CheckBox
For Each cb In ActiveSheet.CheckBoxes
If cb.Value = 1 Then
Debug.Print cb.Name
End If
Next cb
End Sub

--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)
 
hi again,
Thank for your help. However, it seem that it cant work.
The form i am referring to is a VBA form which you create under the
viual basic script editor.

Thank
 
Dim ctl As Control
For Each ctl In Me.Controls
If TypeName(ctl) = "CheckBox" Then
Debug.Print ctl.Name
End If
Next ctl


--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)
 
hi ,
Thank for your help. sorry i need your help again.

How do i display those that have been ticked instead of all the
checkboxes? I had tried your code and it display all the name of the
checkbox.
 
You just test the value for True

Dim ctl As Control
For Each ctl In Me.Controls
If TypeName(ctl) = "CheckBox" Then
If ctl.Value Then
Debug.Print ctl.Name
End If
End If
Next ctl


--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)
 
Back
Top