View Single Post
Old 05-08-2008, 04:26 AM   #24
xluser2007

 
Joined: Dec 2007
Posts: 522
Kb Entries: 0
Articles: 0
Ok, some more good news.

Searched more for precedents and found the following code by Andy Pope of Ozgrid (and VBAX ).

The link for this code is: http://www.ozgrid.com/forum/showthread.php?t=17028

And the code, pasted from this link is:

VBA:
Sub FindPrecedents() ' written by Bill Manville ' With edits from PaulS ' this procedure finds the cells which are the direct precedents of the active cell Dim rLast As Range, iLinkNum As Integer, iArrowNum As Integer Dim stMsg As String Dim bNewArrow As Boolean Application. ScreenUpdating = False ActiveCell.ShowPrecedents Set rLast = ActiveCell iArrowNum = 1 iLinkNum = 1 bNewArrow = True Do Do Application.Goto rLast On Error Resume Next ActiveCell.NavigateArrow TowardPrecedent:=True, ArrowNumber:=iArrowNum, LinkNumber:=iLinkNum If Err.Number > 0 Then Exit Do On Error Goto 0 If rLast.Address(external:=True) = ActiveCell.Address(external:=True) Then Exit Do bNewArrow = False If rLast.Worksheet.Parent.Name = ActiveCell.Worksheet.Parent.Name Then If rLast.Worksheet.Name = ActiveCell.Parent.Name Then ' local stMsg = stMsg & vbNewLine & Selection.Address Else stMsg = stMsg & vbNewLine & "'" & Selection.Parent.Name & "'!" & Selection.Address End If Else ' external stMsg = stMsg & vbNewLine & Selection.Address(external:=True) End If iLinkNum = iLinkNum + 1 ' try another link Loop If bNewArrow Then Exit Do iLinkNum = 1 bNewArrow = True iArrowNum = iArrowNum + 1 'try another arrow Loop rLast.Parent.ClearArrows Application.Goto rLast MsgBox "Precedents are" & stMsg Exit Sub End Sub
VBA tags courtesy of www.thecodenet.com

This finds
  • An external link of an already open workbook
  • An internal link in a different worksheet in the same workbook
  • An internal link in a different worksheet in the same workbook
The only thing remaining is:
  • An external link of a closed workbook, is this possible?
Any VBgurus, this is the final piece of the puzzle, could anyone please help to solve it.

regards,

Local Time: 04:40 PM
Local Date: 05-25-2013
Location:

 
Reply With Quote Top