Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default 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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Userform Controls Nigel Excel Programming 5 December 30th 04 01:49 PM
Help please with UserForm controls sa3214 Excel Programming 4 July 2nd 04 03:00 AM
Bmp vs Gif in Userform image controls Sandy-V[_2_] Excel Programming 0 January 14th 04 01:46 PM
Add controls to UserForm Vyyk Drago Excel Programming 3 August 26th 03 01:22 PM
What order does VBA look at userform controls? Brad Patterson Excel Programming 3 July 17th 03 03:46 AM


All times are GMT +1. The time now is 12:30 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"