Tracking down links

stemar

Board Regular
Joined
Mar 16, 2002
Messages
248
I recently spent a "pleasant" hour trying to find a stray link to another spreadsheet in a large spreadsheet. I couldn't just kill the links as I needed to know where they were to rebuild them later pointing to another file.

In the end I wrote a macro to search for kinks, but couldn't find a direct way to identify a link. This works by looking for ".xls" in a formula, but is there a more elegant way?

For Each Sh In ActiveWorkbook.Worksheets
For Col = 1 To Sh.Cells.SpecialCells(xlCellTypeLastCell).Column
For Row = 1 To Sh.Cells.SpecialCells(xlCellTypeLastCell).Row
If Cells(Row, Col).HasFormula Then
If InStr(1, Cells(Row, Col).Formula, ".xls", vbTextCompare) <> 0 Then
M = M & Sh.Name & " - " & Cells(Row, Col).Address & vbCr
End If
End If
Next Row
Next Col
Next Sh
If M = "" Then M = "No links"
MsgBox M, , ActiveWorkbook.Name
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,422
Messages
5,837,143
Members
430,478
Latest member
masoodb1358

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
Top