force at least one checkbox to be selected

3earth

New Member
Joined
Mar 21, 2010
Messages
17
I have two groups of checkboxes (1-7 and 8-11). I am in need of vba code that will force the user to choose at least one checkbox in the group of 1-7. The checkboxes are in a merged cell range A9:K10.

Additionally, if checkbox 7 is selected then L9:O10 must be filled in.

Checkboxes were inserted by using the form control not activex control.

Excel 2007 is being used.

I found vba code that I use to force tab order (below).

Dim aTabOrd As Variant
Dim iTab As Long
Dim nTab As Long

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim iNew As Long

If IsEmpty(aTabOrd) Then
aTabOrd = Array("D3", "L3", "D5", "L5", "D7", "L7", "A9", "L9", "D12", "M12", _
"E17", "F17", "G17", "E18", "F18", "G18", "E19", "F19", "G19", "E20", "F20", _
"G20", "E21", "F21", "G21", "E22", "F22", "G22", "E23", "F23", "G23", _
"N16", "N16", "N17", "N18", "N19", "N20", "N21", "J22", "N22", "A26", _
"W5", "W6", "W7", "W8", "W9", "W10", "W11", "W12", "W13", "W14", "R15", "W15", _
"W19", "W20", "W21", "R22", "W22", "R28", "T28", "V28", "R30", "T30", "V30", _
"R37", "T37", "V37", "V39", "Q42")
nTab = UBound(aTabOrd) + 1
iTab = 0
Else
On Error Resume Next
iNew = WorksheetFunction.Match(Target(1, 1).Address(False, False), aTabOrd, 0) - 1
If Err Then
iTab = (iTab + 1) Mod nTab
Else
iTab = iNew
End If
On Error GoTo 0
End If

Application.EnableEvents = False
Range(aTabOrd(iTab)).Select
Application.EnableEvents = True

End Sub

NOTE: I am no expert with vba.

Thank you for any help you can provide. :D
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.

Forum statistics

Threads
1,214,622
Messages
6,120,585
Members
448,972
Latest member
Shantanu2024

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top