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

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college

Forum statistics

Threads
1,215,470
Messages
6,124,995
Members
449,201
Latest member
Lunzwe73

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