You are welcome, thanks for the rep.points.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim rng As Range, cell As Range, arr, i As Long, j As Long, v
With Target
If .Count > 1 Or .Column Mod 2 = 0 Or IsEmpty(.Offset(, 1)) Then Exit Sub
Application.ScreenUpdating = False
.Font.Name = "Marlett"
.Value = IIf(.Value = vbNullString, "a", vbNullString)
Application.EnableEvents = False
.Offset(0, 1).Select
Application.EnableEvents = True
On Error Resume Next
Sheets(.Offset(0, 1).Value).Visible = IIf(.Value = vbNullString, xlSheetHidden, xlSheetVisible)
On Error GoTo 0
If .Column = 1 And .Offset(1).EntireRow.OutlineLevel > 1 Then
On Error Resume Next
.Offset(1).EntireRow.ShowDetail = IIf(.Value = vbNullString, False, True)
Set rng = Intersect(Range(Target, Target.End(xlDown).Offset(-1)).EntireRow, ActiveSheet.UsedRange.Offset(, 2)).SpecialCells(xlCellTypeConstants)
If Not rng Is Nothing Then
For Each cell In rng
If cell.Column Mod 2 = 0 Then
If .Value = vbNullString Then
Sheets(cell.Value).Visible = xlSheetHidden
Else
Sheets(cell.Value).Visible = IIf(cell.Offset(0, -1).Value = vbNullString, xlSheetHidden, xlSheetVisible)
End If
End If
Next cell
End If
On Error GoTo 0
End If
Application.ScreenUpdating = True
End With
End Sub
Bookmarks