Hi there,
I have a series of hyperlinks on a tab that when clicked i want to hide/unhide specific rows.
I have looked around online and realize i cannot have more than one Worksheet_FollowHyperlink but that i can build a macro that calls on other macros to work around this.
i have built three simple macros (macro1, macro2 and macro3) for hiding/unhiding the rows but the macro i have that is supposed to call on them doesn't seem to work. I know macro1, macro2 and macro3 work as they hide the rows when triggered manually.
the code i have written so far is;
Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink) If Target.Range.Address = "$c$3" Then
Call macro1
End If
If Target.Range.Address = "$B$6" Then
Call macro2
End If
If Target.Range.Address = "$d$3" Then
Call macro3
End If
End Sub
Sub macro1()
Rows("6:9").Select
If Selection.EntireRow.Hidden = True Then
Selection.EntireRow.Hidden = False
Else
Selection.EntireRow.Hidden = True
End If
End Sub
Sub macro2()
Rows("20:25").Select
If Selection.EntireRow.Hidden = True Then
Selection.EntireRow.Hidden = False
Else
Selection.EntireRow.Hidden = True
End If
End Sub
Sub macro3()
Rows("12:15").Select
If Selection.EntireRow.Hidden = True Then
Selection.EntireRow.Hidden = False
Else
Selection.EntireRow.Hidden = True
End If
End Sub
can anyone help in linking these all together?
Regards,
John
I have a series of hyperlinks on a tab that when clicked i want to hide/unhide specific rows.
I have looked around online and realize i cannot have more than one Worksheet_FollowHyperlink but that i can build a macro that calls on other macros to work around this.
i have built three simple macros (macro1, macro2 and macro3) for hiding/unhiding the rows but the macro i have that is supposed to call on them doesn't seem to work. I know macro1, macro2 and macro3 work as they hide the rows when triggered manually.
the code i have written so far is;
Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink) If Target.Range.Address = "$c$3" Then
Call macro1
End If
If Target.Range.Address = "$B$6" Then
Call macro2
End If
If Target.Range.Address = "$d$3" Then
Call macro3
End If
End Sub
Sub macro1()
Rows("6:9").Select
If Selection.EntireRow.Hidden = True Then
Selection.EntireRow.Hidden = False
Else
Selection.EntireRow.Hidden = True
End If
End Sub
Sub macro2()
Rows("20:25").Select
If Selection.EntireRow.Hidden = True Then
Selection.EntireRow.Hidden = False
Else
Selection.EntireRow.Hidden = True
End If
End Sub
Sub macro3()
Rows("12:15").Select
If Selection.EntireRow.Hidden = True Then
Selection.EntireRow.Hidden = False
Else
Selection.EntireRow.Hidden = True
End If
End Sub
can anyone help in linking these all together?
Regards,
John