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
 

Some videos you may like

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)

Watch MrExcel Video

Forum statistics

Threads
1,122,469
Messages
5,596,322
Members
414,053
Latest member
Dual Showman

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