PC Review


Reply
Thread Tools Rate Thread

Check and clear Multiple check boxes

 
 
Dean
Guest
Posts: n/a
 
      31st Mar 2010
I have about 20 check boxes on sheet1 of a spreadsheet from the Controls tool
box.
5 of them are loners and should not be touched in regard to the remaining 15.
The 15 are Very good, Good, Ok, Bad, Very Bad answers...
Q1 A1,2,3,4,5
Q2 A1,2,3,4,5
Q3 A1,2,3,4,5

I want to be able be click an answer on Q1 and have the code untick all the
other answers for Q1 but not Q2 or Q3, then tick any one of the answers on Q2
and have the code untick all the other boxes on Q2 and same for Q3.
If however the user changes their mind on Q? the code should untick all the
other answers on that Q.

I have (at work) some working code but checking through it on Debug, step
into it jumps backwards and forwards through each of the checkbox?_click()
subs.

Can someone suggest some code to do the above please?

Thanks
Dean
 
Reply With Quote
 
 
 
 
Gary Brown
Guest
Posts: n/a
 
      31st Mar 2010
Example assumes there are 3 checkboxes...
When Checkbox1 is checked/unchecked, checkboxes 2 & 3 are unchecked.
Do the Same type of procedure with checkboxes 2 & 3.

Private Sub CheckBox1_Click()
CheckBox2.Value = False
CheckBox3.Value = False
End Sub

--
Hope this helps.
If it does, please click the Yes button.
Thanks in advance for your feedback.
Gary Brown



"Dean" wrote:

> I have about 20 check boxes on sheet1 of a spreadsheet from the Controls tool
> box.
> 5 of them are loners and should not be touched in regard to the remaining 15.
> The 15 are Very good, Good, Ok, Bad, Very Bad answers...
> Q1 A1,2,3,4,5
> Q2 A1,2,3,4,5
> Q3 A1,2,3,4,5
>
> I want to be able be click an answer on Q1 and have the code untick all the
> other answers for Q1 but not Q2 or Q3, then tick any one of the answers on Q2
> and have the code untick all the other boxes on Q2 and same for Q3.
> If however the user changes their mind on Q? the code should untick all the
> other answers on that Q.
>
> I have (at work) some working code but checking through it on Debug, step
> into it jumps backwards and forwards through each of the checkbox?_click()
> subs.
>
> Can someone suggest some code to do the above please?
>
> Thanks
> Dean

 
Reply With Quote
 
ryguy7272
Guest
Posts: n/a
 
      31st Mar 2010
This will clear all CheckBoxes:
Sub ClearCheckBoxes()
Dim ChkBox As Object
For Each ChkBox In ActiveSheet.CheckBoxes
ChkBox.Value = xlOff
Next ChkBox
End Sub


This will clear all ActiveX CheckBoxes:
Sub UnCheckBoxesActiveX()
Dim objChkBox As OLEObject
With Sheets("Clear All Check Boxes")
For Each objChkBox In .OLEObjects
If TypeName(objChkBox.Object) = "CheckBox" Then
objChkBox.Object.Value = False
End If
Next
End With
End Sub

Modify to suit.

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"Gary Brown" wrote:

> Example assumes there are 3 checkboxes...
> When Checkbox1 is checked/unchecked, checkboxes 2 & 3 are unchecked.
> Do the Same type of procedure with checkboxes 2 & 3.
>
> Private Sub CheckBox1_Click()
> CheckBox2.Value = False
> CheckBox3.Value = False
> End Sub
>
> --
> Hope this helps.
> If it does, please click the Yes button.
> Thanks in advance for your feedback.
> Gary Brown
>
>
>
> "Dean" wrote:
>
> > I have about 20 check boxes on sheet1 of a spreadsheet from the Controls tool
> > box.
> > 5 of them are loners and should not be touched in regard to the remaining 15.
> > The 15 are Very good, Good, Ok, Bad, Very Bad answers...
> > Q1 A1,2,3,4,5
> > Q2 A1,2,3,4,5
> > Q3 A1,2,3,4,5
> >
> > I want to be able be click an answer on Q1 and have the code untick all the
> > other answers for Q1 but not Q2 or Q3, then tick any one of the answers on Q2
> > and have the code untick all the other boxes on Q2 and same for Q3.
> > If however the user changes their mind on Q? the code should untick all the
> > other answers on that Q.
> >
> > I have (at work) some working code but checking through it on Debug, step
> > into it jumps backwards and forwards through each of the checkbox?_click()
> > subs.
> >
> > Can someone suggest some code to do the above please?
> >
> > Thanks
> > Dean

 
Reply With Quote
 
Dean
Guest
Posts: n/a
 
      1st Apr 2010
Ryan, this will clear all the check boxes. I only want the five related to
each question clearing.

Gary,this is the code I currently use and it seams that it is re-checking
each checkbox when they are changed.
the code is in the "Click" event. When I click A1 it clears A2,A3,A4,A5 but
runs the code in A2, A3, A4, A5 as if I had clicked them.

Dean

"ryguy7272" wrote:

> This will clear all CheckBoxes:
> Sub ClearCheckBoxes()
> Dim ChkBox As Object
> For Each ChkBox In ActiveSheet.CheckBoxes
> ChkBox.Value = xlOff
> Next ChkBox
> End Sub
>
>
> This will clear all ActiveX CheckBoxes:
> Sub UnCheckBoxesActiveX()
> Dim objChkBox As OLEObject
> With Sheets("Clear All Check Boxes")
> For Each objChkBox In .OLEObjects
> If TypeName(objChkBox.Object) = "CheckBox" Then
> objChkBox.Object.Value = False
> End If
> Next
> End With
> End Sub
>
> Modify to suit.
>
> --
> Ryan---
> If this information was helpful, please indicate this by clicking ''Yes''.
>
>
> "Gary Brown" wrote:
>
> > Example assumes there are 3 checkboxes...
> > When Checkbox1 is checked/unchecked, checkboxes 2 & 3 are unchecked.
> > Do the Same type of procedure with checkboxes 2 & 3.
> >
> > Private Sub CheckBox1_Click()
> > CheckBox2.Value = False
> > CheckBox3.Value = False
> > End Sub
> >
> > --
> > Hope this helps.
> > If it does, please click the Yes button.
> > Thanks in advance for your feedback.
> > Gary Brown
> >
> >
> >
> > "Dean" wrote:
> >
> > > I have about 20 check boxes on sheet1 of a spreadsheet from the Controls tool
> > > box.
> > > 5 of them are loners and should not be touched in regard to the remaining 15.
> > > The 15 are Very good, Good, Ok, Bad, Very Bad answers...
> > > Q1 A1,2,3,4,5
> > > Q2 A1,2,3,4,5
> > > Q3 A1,2,3,4,5
> > >
> > > I want to be able be click an answer on Q1 and have the code untick all the
> > > other answers for Q1 but not Q2 or Q3, then tick any one of the answers on Q2
> > > and have the code untick all the other boxes on Q2 and same for Q3.
> > > If however the user changes their mind on Q? the code should untick all the
> > > other answers on that Q.
> > >
> > > I have (at work) some working code but checking through it on Debug, step
> > > into it jumps backwards and forwards through each of the checkbox?_click()
> > > subs.
> > >
> > > Can someone suggest some code to do the above please?
> > >
> > > Thanks
> > > Dean

 
Reply With Quote
 
Gary Brown
Guest
Posts: n/a
 
      1st Apr 2010
When you click on CheckBox1 and it does something to Checkbox2, the Change
AND Click methods in CheckBox2 fire up. You have to work your code around
that situation.
--
Hope this helps.
If it does, please click the Yes button.
Thanks in advance for your feedback.
Gary Brown



"Dean" wrote:

> Ryan, this will clear all the check boxes. I only want the five related to
> each question clearing.
>
> Gary,this is the code I currently use and it seams that it is re-checking
> each checkbox when they are changed.
> the code is in the "Click" event. When I click A1 it clears A2,A3,A4,A5 but
> runs the code in A2, A3, A4, A5 as if I had clicked them.
>
> Dean
>
> "ryguy7272" wrote:
>
> > This will clear all CheckBoxes:
> > Sub ClearCheckBoxes()
> > Dim ChkBox As Object
> > For Each ChkBox In ActiveSheet.CheckBoxes
> > ChkBox.Value = xlOff
> > Next ChkBox
> > End Sub
> >
> >
> > This will clear all ActiveX CheckBoxes:
> > Sub UnCheckBoxesActiveX()
> > Dim objChkBox As OLEObject
> > With Sheets("Clear All Check Boxes")
> > For Each objChkBox In .OLEObjects
> > If TypeName(objChkBox.Object) = "CheckBox" Then
> > objChkBox.Object.Value = False
> > End If
> > Next
> > End With
> > End Sub
> >
> > Modify to suit.
> >
> > --
> > Ryan---
> > If this information was helpful, please indicate this by clicking ''Yes''.
> >
> >
> > "Gary Brown" wrote:
> >
> > > Example assumes there are 3 checkboxes...
> > > When Checkbox1 is checked/unchecked, checkboxes 2 & 3 are unchecked.
> > > Do the Same type of procedure with checkboxes 2 & 3.
> > >
> > > Private Sub CheckBox1_Click()
> > > CheckBox2.Value = False
> > > CheckBox3.Value = False
> > > End Sub
> > >
> > > --
> > > Hope this helps.
> > > If it does, please click the Yes button.
> > > Thanks in advance for your feedback.
> > > Gary Brown
> > >
> > >
> > >
> > > "Dean" wrote:
> > >
> > > > I have about 20 check boxes on sheet1 of a spreadsheet from the Controls tool
> > > > box.
> > > > 5 of them are loners and should not be touched in regard to the remaining 15.
> > > > The 15 are Very good, Good, Ok, Bad, Very Bad answers...
> > > > Q1 A1,2,3,4,5
> > > > Q2 A1,2,3,4,5
> > > > Q3 A1,2,3,4,5
> > > >
> > > > I want to be able be click an answer on Q1 and have the code untick all the
> > > > other answers for Q1 but not Q2 or Q3, then tick any one of the answers on Q2
> > > > and have the code untick all the other boxes on Q2 and same for Q3.
> > > > If however the user changes their mind on Q? the code should untick all the
> > > > other answers on that Q.
> > > >
> > > > I have (at work) some working code but checking through it on Debug, step
> > > > into it jumps backwards and forwards through each of the checkbox?_click()
> > > > subs.
> > > >
> > > > Can someone suggest some code to do the above please?
> > > >
> > > > Thanks
> > > > Dean

 
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
RE: Clear check boxes? Geoff Microsoft Excel Programming 0 1st Dec 2009 08:09 PM
Check all check boxes in a multiple form Danny Morales Microsoft Access 1 24th Jul 2007 11:03 PM
How do I clear all check boxes w/out manually unchecking boxes? =?Utf-8?B?VEo=?= Microsoft Access 12 25th Aug 2005 02:40 AM
Can I check multiple check boxes with one click? =?Utf-8?B?dG9iZXN1cw==?= Microsoft Access Forms 1 12th Aug 2005 01:38 AM
how do i check multiple check boxes in access to save me clicking. =?Utf-8?B?c21va3liZWNraGFt?= Microsoft Access 2 28th Oct 2004 06:49 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:42 PM.