Greetings Pat,
I am not sure I was totally understanding the goals in areas two and four. So a bit of guessing, but see if this helps.
Rather than test against the one named range, I defined four: Group_01 for Range("G5:G8"), Group_02 for Range("G10:G18") and so on for the four ranges of interest.
In the Worksheet Module:
Option Explicit
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Application.Intersect(Target, _
Application.Union(Range("Group_01"), _
Range("Group_02"), _
Range("Group_03"), _
Range("Group_04") _
) _
) Is Nothing Then
Exit Sub
End If
Cancel = True
Select Case True
Case Not Application.Intersect(Target, Range("Group_01")) Is Nothing
If Target.Value = "a" Then
Target.ClearContents
If Not RangeNotEmpty(Range("Group_01")) Then
Range("G5").Value = "a"
End If
Else
Range("Group_01").ClearContents
Target.Value = "a"
End If
'group with children. Need to make the default G17 if either G10,G12 or G17 are selected.
Case Not Application.Intersect(Target, Range("Group_02")) Is Nothing
If Target.Value = "a" Then
Target.ClearContents
If RangeNotEmpty(Range("G10,G12")) Then
Range("G17").Value = "a"
End If
Else
Range("Group_02").ClearContents
Target.Value = "a"
If RangeNotEmpty(Range("G10,G12")) Then
Range("G17").Value = "a"
End If
End If
Case Not Application.Intersect(Target, Range("Group_03")) Is Nothing
If Target.Value = "a" Then
Target.ClearContents
If Not RangeNotEmpty(Range("Group_03")) Then
Range("G22").Value = "a"
End If
Else
Range("Group_03").ClearContents
Target.Value = "a"
End If
'If G29 or G30 is checked, check G28. Is there a way not to let them
'uncheck G28 (parent) if G29 and G30 (Children are selected)?
Case Not Application.Intersect(Target, Range("Group_04")) Is Nothing
If Target.Value = "a" Then
Target.ClearContents
If RangeNotEmpty(Range("G29:G30")) Then
Range("G28").Value = "a"
End If
Else
Range("Group_04").ClearContents
Target.Value = "a"
If RangeNotEmpty(Range("G29:G30")) Then
Range("G28").Value = "a"
End If
End If
End Select
End Sub
Private Function RangeNotEmpty(rng As Range) As Boolean
Dim r As Range
For Each r In rng
If r.Value = "a" Then
RangeNotEmpty = True
Exit Function
End If
Next
End Function
The above assumes the font has already been changed. I hope I didn't 'swing and miss' at the start, but I could not see how Target.Count could be anything other than 1?
Hope this helps,
Mark