VBA Code - Trace Precedents across worksheets by making Go To box pop up

CSSouthern

New Member
Joined
Apr 5, 2021
Messages
5
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2013
Platform
  1. Windows
Hi,

I know this VBA code is out there, but seemingly haven't found the right formula. Can someone help me figure out how to trace precedents across worksheets using a macro that pops open the GO TO box after using the shortcut key.

Thanks!
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Hi - it's a one-liner. You just need to put it in a sub:

VBA Code:
Application.CommandBars.ExecuteMso "GoTo"

If you need to know other shortcuts, built-in commands are called IdMSO. Hope that helps.
 
Upvote 0
Hi - it's a one-liner. You just need to put it in a sub:

VBA Code:
Application.CommandBars.ExecuteMso "GoTo"

If you need to know other shortcuts, built-in commands are called IdMSO. Hope that helps.
Thank you Thank you Thank you! I have been looking for this for a few days! Really Appreciated
 
Upvote 0
Actually, this only goes to cells in that sheet. Do you know how to edit it to trace across sheets?
 
Upvote 0
Ahh apologies - you did say across worksheets. What's the caption/name of the pop-up window you want?
 
Upvote 0
The exact thing that the code you wrote does. Bring up the Go To box, but it is only popping up with contents for cells that reference cells in the same worksheet. How should i modify the code to be able to pull up references in another worksheet?
 
Upvote 0
It's working for me. Try selecting the relevant cell with the precedents/dependents and try it again.
 
Upvote 0
This doesn't invoke the GoTo dialog box, but it does take you to the off sheet president ranges.
Select the cell with the formula and run this
VBA Code:
Sub test()
    Dim myCell As Range, onePrecedent As Range
    Dim i As Long
    Set myCell = Selection.Cells(1, 1)
    
    myCell.ShowPrecedents
    i = 1
    
    Do
        On Error GoTo Out
        Set onePrecedent = myCell.NavigateArrow(True, 1, i)
        On Error GoTo 0
        Select Case MsgBox("Precedent #" & i & vbCr & "at " & onePrecedent.Address(, , , True), vbOKCancel)
            Case Is = vbCancel
                Exit Sub
        End Select
        i = i + 1
    Loop
Out:
    Application.Goto myCell
    myCell.Parent.ClearArrows
End Sub
 
Upvote 0
Thanks all for the help! I decided to download Arixcel. The license was only $24 for a full year of access and the "explore precedents" was exactly what I needed. Let me know if there is something bad about the plug-in that I don't know - i.e. viruses.
 
Upvote 0

Forum statistics

Threads
1,223,912
Messages
6,175,341
Members
452,638
Latest member
Oluwabukunmi

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top