Adding history to link follower

Saqib Husain, Syed
Saqib Husain, Syed used Ask the Experts™
on
I had this question appropriately answered. Macro to follow links.

Can someone modify this to track a history so that If I go a few files deep into tracking the links I can retrack back to the original cell?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2016
Commented:
Hi,

pls try in a normal module

Sub GoTowards()
    If Breadcrumbs Is Nothing Then
    Set Breadcrumbs = New clsBreadcrumbs
    End If
    Set OrigRng = ActiveCell
    Breadcrumbs.Add ActiveCell
    For Each varLink In ActiveWorkbook.LinkSources(xlExcelLinks)
        If InStr(1, Replace(OrigRng.Formula, "[", ""), varLink) > 0 Then
                Workbooks.Open varLink
        End If
    Next varLink
    ActiveCell.ShowPrecedents
    OrigRng.NavigateArrow TowardPrecedent:=True, ArrowNumber:=1, LinkNumber:=1
    On Error Resume Next
    Workbooks(OrigRng.Parent.Parent.FullName).Worksheets(OrigRng.Parent.Name).ClearArrows
    On Error GoTo 0
End Sub
Sub GoBack()
    If Breadcrumbs.Count > 0 Then
        Set OrigRng = Breadcrumbs.Item(Breadcrumbs.Count).rng
        Breadcrumbs.Remove Breadcrumbs.Count
        Windows(OrigRng.Parent.Parent.Name).Activate
        Worksheets(OrigRng.Parent.Name).ClearArrows
        Sheets(OrigRng.Parent.Name).Activate
        Range(OrigRng.Address).Activate
    End If
End Sub

Open in new window

in class module named clsBreadCrumb
Public rng As Range

Open in new window

in a class module named cls Breadcrumbs
Public Breadcrumbs As New Collection
Sub Add(myrng As Range)
Dim b As New clsBreadcrumb
Set b.rng = myrng
Breadcrumbs.Add b
End Sub
Property Get Count() As Long
Count = Breadcrumbs.Count
End Property
Property Get Item(NameOrNumber As Variant) As clsBreadcrumb
Set Item = Breadcrumbs(NameOrNumber)
End Property
Sub Remove(NameOrNumber As Variant)
Breadcrumbs.Remove NameOrNumber
End Sub

Open in new window

Regards
EE20160329.xlsm
Martin LissOlder than dirt
Most Valuable Expert 2017
Distinguished Expert 2018

Commented:
I've requested that this question be closed as follows:

Accepted answer: 500 points for Rgonzo1971's comment #a41526915

for the following reason:

This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial