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
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