Very new to Excel Macros and I have managed to do what I want with 6 boxes but they need to work as 2 sets of 3.

The code allows me to only have 1 CheckBox on at once, but I need this to happen separately for boxes 1-3 and 4-6

So Question 1, 3 possible answers, but only 1 can be ticked, then when I move to question 2, only one possible answer again, but the answer cant turn any of the previous answers off and visa versa

Here is the code :-

Sub CheckBox1()

Dim cb As CheckBox

For Each cb In ActiveSheet.CheckBoxes
    If cb.Name <> ActiveSheet.CheckBoxes("Check Box 1").Name Then
        cb.Value = ActiveSheet.CheckBoxes("Check Box 2").Value = True
End If

Next

End Sub
Sub CheckBox2()

Dim cb As CheckBox

For Each cb In ActiveSheet.CheckBoxes
    If cb.Name <> ActiveSheet.CheckBoxes("Check Box 2").Name Then
        cb.Value = ActiveSheet.CheckBoxes("Check Box 3").Value = True
End If

Next

End Sub
Sub CheckBox3()

Dim cb As CheckBox

For Each cb In ActiveSheet.CheckBoxes
    If cb.Name <> ActiveSheet.CheckBoxes("Check Box 3").Name Then
        cb.Value = ActiveSheet.CheckBoxes("Check Box 1").Value = True
End If

Next

End Sub
Sub CheckBox4()

Dim cb As CheckBox

For Each cb In ActiveSheet.CheckBoxes
    If cb.Name <> ActiveSheet.CheckBoxes("Check Box 4").Name Then
        cb.Value = ActiveSheet.CheckBoxes("Check Box 5").Value = True
End If

Next

End Sub
Sub CheckBox5()

Dim cb As CheckBox

For Each cb In ActiveSheet.CheckBoxes
    If cb.Name <> ActiveSheet.CheckBoxes("Check Box 5").Name Then
        cb.Value = ActiveSheet.CheckBoxes("Check Box 6").Value = True
End If

Next

End Sub
Sub CheckBox6()

Dim cb As CheckBox

For Each cb In ActiveSheet.CheckBoxes
    If cb.Name <> ActiveSheet.CheckBoxes("Check Box 6").Name Then
        cb.Value = ActiveSheet.CheckBoxes("Check Box 4").Value = True
End If

Next

End Sub

0 Answers