Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Select All Checkboxes at once

263 views
Skip to first unread message

babs

unread,
Jun 3, 2003, 12:27:00 PM6/3/03
to
I've a number of Checkboxes on my User Form in VB. Is there a way I
can make them all Selected by pressing a custom button like 'Select
All'. Going through each one by one for 29 checkboxes is lot of
coding..

suggest..

Ron de Bruin

unread,
Jun 3, 2003, 12:41:10 PM6/3/03
to
Try this

Private Sub CommandButton1_Click()
For Each ctrl In UserForm1.Controls
If TypeOf ctrl Is MSForms.CheckBox Then
ctrl.Value = True
End If
Next
End Sub


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl

"babs" <bab...@hotmail.com> wrote in message news:1d426aa7.03060...@posting.google.com...

Bob Phillips

unread,
Jun 3, 2003, 12:47:15 PM6/3/03
to
Babs,

Here is some code for your commandbutton

Private Sub CommandButton1_Click()
Dim ctrl As Control
For Each ctrl In Controls
If TypeOf ctrl Is msforms.CheckBox Then


ctrl.Value = True
End If

Next ctrl
End Sub


--
HTH

-------

Bob Phillips
... looking out across Poole Harbour to the Purbecks


"babs" <bab...@hotmail.com> wrote in message
news:1d426aa7.03060...@posting.google.com...

0 new messages