Thread
:
Adding controls to userform
View Single Post
#
1
Posted to microsoft.public.excel.programming
Tushar Mehta
external usenet poster
Posts: 1,071
Adding controls to userform
Two points.
(1) You may also want to check John Walkenbach's
http://j-
walk.com/ss/excel/tips/tip44.htm
(2) While leaving out a reference to an object's default property is
usually OK, it has been known to cause problems -- and is not
acceptable in the .Net world. If I were you, I'd use Checkbox{n}.Value
--
Regards,
Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions
In article ,
says...
I have a userform with checkboxes. As the form and
routine progress in the development phase, I want to
program in an efficient manner so that I can add the new
controls as quickly and efficiently as possible. The
check boxes are are independent. There are 7 of them.
Number 7 is a "Select All" checkbox. Now when I decide to
add another checkbox (chckbx8). I will, based on this
code, have to create:
1) a new click event for chckbx8
2) edit the click event in checkbox7 (select all chkbox)
to incorporate chckbx8
If there a more efficient way to code this knowing that I
will be adding checkboxes gong forward? Or is this the
best way to do it?
Private Sub CheckBox1_Click()
If CheckBox1 = False Then
CheckBox7 = False
End If
End Sub
Private Sub CheckBox2_Click()
If CheckBox2 = False Then
CheckBox7 = False
End If
End Sub
Private Sub CheckBox3_Click()
If CheckBox3 = False Then
CheckBox7 = False
End If
End Sub
Private Sub CheckBox4_Click()
If CheckBox5 = False Then
CheckBox7 = False
End If
End Sub
Private Sub CheckBox5_Click()
If CheckBox6 = False Then
CheckBox7 = False
End If
End Sub
Private Sub CheckBox6_Click()
If CheckBox6 = True Then
CheckBox1 = True
CheckBox2 = True
CheckBox3 = True
CheckBox4 = True
CheckBox5 = True
End If
If CheckBox6 = False Then
CheckBox1 = False
CheckBox2 = False
CheckBox3 = False
CheckBox4 = False
CheckBox5 = False
End If
End Sub
Reply With Quote
Tushar Mehta
View Public Profile
Find all posts by Tushar Mehta