I have a table with a series of hyperlinks that I am using to trigger a macro for hiding/unhiding certain rows.
Cell C3 contains the main menu, when it is clicked a collection of sub menus headings become unhidden in rows 6, 78, 155, 177 & 354.
In turn, when each of the sub menu headings are clicked more rows become unhidden with sub menu content. For example; clicking the sub menu heading in B6 unhides the sub menu content in rows 7:10.
Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
If Target.Range.Address = "$C$3" Then
Call CMC_WIPBreakdown
End If
If Target.Range.Address = "$B$6" Then
Call CMC_CaseProgress
End If
Sub CMC_WIPBreakdown()
Range("6:6").Select
If Selection.EntireRow.Hidden = True Then
Selection.EntireRow.Hidden = False
Else
Selection.EntireRow.Hidden = True
End If
End Sub
Sub CMC_CaseProgress()
Range("7:10").Select
If Selection.EntireRow.Hidden = True Then
Selection.EntireRow.Hidden = False
Else
Selection.EntireRow.Hidden = True
End If
End Sub
The issue I am having is that when it comes to hiding the rows again they have to be hidden in order, ie the sub menu contents from each of the sub menus (rows 7:10) has to be hidden (by clicking b6) before clicking c3 to hide the sub menu itself.
I was looking for a way so that when c3 is clicked, if the sub menu heading (row 6) and their contents (7:10) are unhidden then both are rehidden. If c3 is clicked and they are hidden then only the sub menus headings are unhidden.
Regards,
John.
Cell C3 contains the main menu, when it is clicked a collection of sub menus headings become unhidden in rows 6, 78, 155, 177 & 354.
In turn, when each of the sub menu headings are clicked more rows become unhidden with sub menu content. For example; clicking the sub menu heading in B6 unhides the sub menu content in rows 7:10.
Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
If Target.Range.Address = "$C$3" Then
Call CMC_WIPBreakdown
End If
If Target.Range.Address = "$B$6" Then
Call CMC_CaseProgress
End If
Sub CMC_WIPBreakdown()
Range("6:6").Select
If Selection.EntireRow.Hidden = True Then
Selection.EntireRow.Hidden = False
Else
Selection.EntireRow.Hidden = True
End If
End Sub
Sub CMC_CaseProgress()
Range("7:10").Select
If Selection.EntireRow.Hidden = True Then
Selection.EntireRow.Hidden = False
Else
Selection.EntireRow.Hidden = True
End If
End Sub
The issue I am having is that when it comes to hiding the rows again they have to be hidden in order, ie the sub menu contents from each of the sub menus (rows 7:10) has to be hidden (by clicking b6) before clicking c3 to hide the sub menu itself.
I was looking for a way so that when c3 is clicked, if the sub menu heading (row 6) and their contents (7:10) are unhidden then both are rehidden. If c3 is clicked and they are hidden then only the sub menus headings are unhidden.
Regards,
John.