Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Good Afternoon,
I working on an Excel Sheet that Im setting up as a Test. I have set-up Checkboxes using the Tools/Forms option that Im linking to corresponding cells (the cells reflect a True or False value dependant on if they are checked or not). I found a formula which Ive pasted below that will Clear all the check boxes and works great, but I also need a formula that will set up a Data Validation/ Constraint for each group of questions. Since I cannot use the typical Data Validation because no one is actually clicking the cells itself is there a way to monitor just the checkboxes themselves? For example, I have a group of 5 checkboxes in Cells B15, B16, B17, F15 and F16 which all have different answers to a related question. What I need is a way to make sure the User does NOT check 2 Boxes. Any ideas would be greatly appreciated and thank you in advance for your thoughts Jenny B. |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() Sub Uncheckboxes() Dim wks As Worksheet Dim ckbx As OLEObject Set wks = Worksheets("background") With wks .CheckBoxes.Value = False 'Form type clear For Each ckbx In wks.OLEObjects ckbx.Object.Value = False 'ActiveX type clear Next ckbx End With End Sub "Jenny B." wrote: Good Afternoon, I working on an Excel Sheet that Im setting up as a Test. I have set-up Checkboxes using the Tools/Forms option that Im linking to corresponding cells (the cells reflect a True or False value dependant on if they are checked or not). I found a formula which Ive pasted below that will Clear all the check boxes and works great, but I also need a formula that will set up a Data Validation/ Constraint for each group of questions. Since I cannot use the typical Data Validation because no one is actually clicking the cells itself is there a way to monitor just the checkboxes themselves? For example, I have a group of 5 checkboxes in Cells B15, B16, B17, F15 and F16 which all have different answers to a related question. What I need is a way to make sure the User does NOT check 2 Boxes. Any ideas would be greatly appreciated and thank you in advance for your thoughts Jenny B. |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
It appears your CheckBoxes came from the Forms toolbar (as opposed to them
being ActiveX controls). Given that, the Uncheckboxes subroutine can be replaced with this single line... Worksheets("background").CheckBoxes.Value = False or, if you code is executing from the same worksheet as the CheckBoxes are on... ActiveSheet.CheckBoxes.Value = False This solution is modeled after a post Dave Peterson offered on Wed, 18 Jul 2007 11:07:30 (-0500) on the microsoft.public.excel.programming newsgroup (Subject: Visual Basic code). In that posting, Dave was deleting Form Toolbar generated Option buttons. He also warned that the deletions wouldn't work if there were too many (without specifying how many that might be) OptionButtons on the worksheet. I am not sure whether this limit would apply to the above or not, but I test it out for 100 CheckBoxes and it worked fine. I would have provided a link to the posting, but Google isn't showing any posts after July 17th right now. Didn't Google used to be only several hours behind physical postings in the past? Is Google broken or, perhaps, just over-extended? Anyone else seeing these kind of delays in Google? Rick "Jenny B." wrote in message ... Sub Uncheckboxes() Dim wks As Worksheet Dim ckbx As OLEObject Set wks = Worksheets("background") With wks .CheckBoxes.Value = False 'Form type clear For Each ckbx In wks.OLEObjects ckbx.Object.Value = False 'ActiveX type clear Next ckbx End With End Sub "Jenny B." wrote: Good Afternoon, I working on an Excel Sheet that Im setting up as a Test. I have set-up Checkboxes using the Tools/Forms option that Im linking to corresponding cells (the cells reflect a True or False value dependant on if they are checked or not). I found a formula which Ive pasted below that will Clear all the check boxes and works great, but I also need a formula that will set up a Data Validation/ Constraint for each group of questions. Since I cannot use the typical Data Validation because no one is actually clicking the cells itself is there a way to monitor just the checkboxes themselves? For example, I have a group of 5 checkboxes in Cells B15, B16, B17, F15 and F16 which all have different answers to a related question. What I need is a way to make sure the User does NOT check 2 Boxes. Any ideas would be greatly appreciated and thank you in advance for your thoughts Jenny B. |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
What I need is a way to make
sure the User does NOT check 2 Boxes. Why aren't you using Option Buttons then? Rick |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi Rick,
Im not using the Option Button because Im not that familiar with it (also it does not have a simpleton link to each cell like the checkbox). Additionally, Im trying to capture what each cell/checkbox reads out after selected. This means if I have a group of 4 answers Im looking to note the answer selected to another page. So if someone chooses answer (checkbox 2), Ive also set-up a formula on another page that captures that data for later review. Thats why I was looking to put the constraints on the question group. If someone checks more than one box, it pulls over multiple answers and that screws up my data collection. Is there any quick Macro you could help me with (still using the checkboxes) that could assign each check box a value (for instance checkbox1 = 1 etc)? That way, I could set up a validation Macro that would somehow state that 1 would bring up a msgbox letting them know they can only select one from the group. Thanks so much for your help and appreciate any further advice Jenny B. "Rick Rothstein (MVP - VB)" wrote: What I need is a way to make sure the User does NOT check 2 Boxes. Why aren't you using Option Buttons then? Rick |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Data Validation Question | Excel Worksheet Functions | |||
Data Validation Question | Excel Discussion (Misc queries) | |||
Data Validation Question | Excel Discussion (Misc queries) | |||
DataValidation Question | New Users to Excel | |||
Data validation question | New Users to Excel |