Check Box - Forced Validation

austin350s10

Active Member
Joined
Jul 30, 2010
Messages
321
I have a form I am working on that has multiple series of check boxes. Each series contains 4 check boxes.

Example:
Series 1
Check box 1 value associated = 1
Check box 2 value associated = 2
Check box 3 value associated = 3
Check box 4 value associated = 4

Series 2
Check box 1 value associated = 1
Check box 2 value associated = 2
Check box 3 value associated = 3
Check box 4 value associated = 4

PROBLEM: For the form to work properly the user can only check 1 of the 4 check boxes in the current series. However with my novice experience in excel I can't seem to force excel to allow only 1 of the 4 check boxes to be check at any given time.

QUESTION: Is there a solution that would apply to all the series of check boxes without having to use Option Buttons?

NOTE: The user also needs to have the option of not checking any of the boxes in a series.
 

Some videos you may like

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.

Sahak

Well-known Member
Joined
Nov 10, 2006
Messages
874
Hi austin350s10

Try this
Code:
Private Sub CheckBox1_Click()
    If CheckBox1.Value = True Then
       CheckBox2.Value = False
       CheckBox3.Value = False
       CheckBox4.Value = False
    Else: End If
End Sub
Private Sub CheckBox2_Click()
    If CheckBox2.Value = True Then
       CheckBox1.Value = False
       CheckBox3.Value = False
       CheckBox4.Value = False
    Else: End If
End Sub
Private Sub CheckBox3_Click()
    If CheckBox3.Value = True Then
       CheckBox1.Value = False
       CheckBox2.Value = False
       CheckBox4.Value = False
    Else: End If
End Sub
Private Sub CheckBox4_Click()
    If CheckBox4.Value = True Then
       CheckBox1.Value = False
       CheckBox2.Value = False
       CheckBox3.Value = False
    Else: End If
End Sub
For Series 2 use CheckBox5, CheckBox6, CheckBox7, CheckBox8
 
Last edited:

Fowmy

Well-known Member
Joined
Jul 10, 2008
Messages
512
Office Version
365
Platform
Windows
Include each series of checkbox and a frame and modify the following code


Code:
Sub chk(cb As MSForms.CheckBox)
If cb = False Then Exit Sub
Dim i As MSForms.CheckBox
For Each i In Me.Frame1.Controls
    i = False
Next
 cb = True
End Sub
Private Sub CheckBox1_Click()
    Call chk(CheckBox1)
End Sub
Private Sub CheckBox4_Click()
    Call chk(CheckBox4)
End Sub
Private Sub CheckBox2_Click()
Call chk(CheckBox2)
End Sub
Private Sub CheckBox3_Click()
Call chk(CheckBox3)
End Sub
 

Subscribe on YouTube

Watch MrExcel Video

Forum statistics

Threads
1,106,821
Messages
5,513,587
Members
408,962
Latest member
DCESL

This Week's Hot Topics

  • Sort code advice please
    Hi, I have the code below which im trying to edit but getting a little stuck. This was the original code which worked fine,columns A-F would sort...
  • SUMPRODUCT with nested If statement
    Hi everyone, Hope you're all well. I'm hoping someone will be able to point me in the right direction with a problem I'm having with a SUMPRODUCT...
  • VBA - simple sort is killing me!
    Hello all! This should be so easy, but not for me, apparently! I have a table of data that can be of varying lengths and widths. My current macro...
  • Compare Two Lists
    I have two Lists and I need to be able to Identify differences between them. List 100 comes from a workbook - the other is downloaded form the...
  • Formula that deducts points for each code I input.
    I am trying to create a formula that will have each student in my class start at 100 points and then for each code that I enter (PP for Poor...
  • Conditional formatting formula required for day of week and a value
    Hi, I have a really simple spreadsheet where column A is the date, column B is the activity total shown as a number and column C states the day of...
Top