PC Review


Reply
Thread Tools Rate Thread

Count CheckBoxes in a Frame that are True

 
 
RyanH
Guest
Posts: n/a
 
      7th Feb 2008
I want to disable a ComboBox if all 4 CheckBox Values in a UserForm Frame are
True. How do I do this?

Ryan
 
Reply With Quote
 
 
 
 
John Bundy
Guest
Posts: n/a
 
      7th Feb 2008
The easy way is:
if checkbox1=true then
if checkbox2=true then
if checkbox3=true then
if checkbox4=true then
combobox1.Enabled=False
end if
end if
end if
end if
--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"RyanH" wrote:

> I want to disable a ComboBox if all 4 CheckBox Values in a UserForm Frame are
> True. How do I do this?
>
> Ryan

 
Reply With Quote
 
RyanH
Guest
Posts: n/a
 
      7th Feb 2008
That is an easy way to do it! Do you know of a cleaner way to do it, like a
Loop? Such as count the true check boxes and if it = 4 then disable combobox.
I assume I have to put this code under the Click_Event of each checkbox so
if it is shorter to write a loop I would prefer that. Not to be picky or
anything, lol.

Thanks for the quick response,
Ryan

"John Bundy" wrote:

> The easy way is:
> if checkbox1=true then
> if checkbox2=true then
> if checkbox3=true then
> if checkbox4=true then
> combobox1.Enabled=False
> end if
> end if
> end if
> end if
> --
> -John
> Please rate when your question is answered to help us and others know what
> is helpful.
>
>
> "RyanH" wrote:
>
> > I want to disable a ComboBox if all 4 CheckBox Values in a UserForm Frame are
> > True. How do I do this?
> >
> > Ryan

 
Reply With Quote
 
john
Guest
Posts: n/a
 
      7th Feb 2008
I am sure this can be done a better way but as a quick suggestion following
may do what you want (not tested):

Dim i As Integer
Dim a As Integer
a = 0
For i = 1 To 4
If Controls("CheckBox" & i).Value = True Then
a = a + 1
End If
Next

With ComboBox1
If a = 4 Then
.Enabled = False
Else
.Enabled = True
End If
End With
--
JB


"RyanH" wrote:

> I want to disable a ComboBox if all 4 CheckBox Values in a UserForm Frame are
> True. How do I do this?
>
> Ryan

 
Reply With Quote
 
Jim Cone
Guest
Posts: n/a
 
      7th Feb 2008

Take the product of their values and if not equal to zero then all are checked.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)


"RyanH"
wrote in message
I want to disable a ComboBox if all 4 CheckBox Values in a UserForm Frame are
True. How do I do this?
Ryan
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
TRUE/FALSE from checkboxes =?Utf-8?B?UGhpbCBEYXZ5?= Microsoft Excel Misc 4 27th Sep 2007 04:09 PM
Counting true checkboxes =?Utf-8?B?S2Vu?= Microsoft Access Reports 1 16th Nov 2006 01:39 PM
Assessing whether any checkboxes are checked within frame =?Utf-8?B?RXhjZWxNb25rZXk=?= Microsoft Excel Programming 1 16th Oct 2005 09:19 PM
True/False Checkboxes dankim Microsoft Excel Programming 1 12th Jul 2004 05:59 PM
Counting checkboxes with a true value Antje Crawford Microsoft Excel Programming 3 7th Nov 2003 06:48 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:11 AM.