+ Reply to Thread
Results 1 to 5 of 5

Find cells that contain links to unavailable sources

Hybrid View

  1. #1
    Forum Contributor Mvaldesi's Avatar
    Join Date
    01-21-2011
    Location
    Plano, TX
    MS-Off Ver
    MS365 (PC) v.2108
    Posts
    271

    Find cells that contain links to unavailable sources

    Good afternoon, Gurus and Experts,

    I've been "gifted" a workbook that contains links to an external source that no longer exists, so whenever I open it, it prompts to update the links, then follows with the inevitable "can't update" error message. I can determine which workbook it's trying to update from, but not which cells are trying; is there an easy way to find out? There are several sheet and thousands of populated cells, so going cell by cell isn't really feasible. Thanks in advance!

  2. #2
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Find cells that contain links to unavailable sources

    The following VBA macro can help list all linked source workbooks in a new worksheet of current workbook.
    (credit: https://www.extendoffice.com/documen...all-links.html)

    1. Hold down the ALT + F11 keys, and it opens the Microsoft Visual Basic for Applications window.

    2. Click Insert > Module, and paste the following macro in the Module Window.

    VBA: List all links in Excel.
    Sub ListLinks()
        Dim xSheet As Worksheet
        Dim xRg As Range
        Dim xCell As Range
        Dim xCount As Long
        Dim xLinkArr() As String
        On Error Resume Next
        For Each xSheet In Worksheets
            Set xRg = xSheet.UsedRange.SpecialCells(xlCellTypeFormulas)
            If xRg Is Nothing Then GoTo LblNext
            For Each xCell In xRg
                If InStr(1, xCell.Formula, "[") > 0 Then
                    xCount = xCount + 1
                    ReDim Preserve xLinkArr(1 To 2, 1 To xCount)
                    xLinkArr(1, xCount) = xCell.Address(, , , True)
                    xLinkArr(2, xCount) = "'" & xCell.Formula
               End If
            Next
    LblNext:
        Next
        If xCount > 0 Then
            Sheets.Add(Sheets(1)).Name = "Link Sheet"
            Range("A1").Resize(, 2).Value = Array("Location", "Reference")
            Range("A2").Resize(UBound(xLinkArr, 2), UBound(xLinkArr, 1)).Value = Application.Transpose(xLinkArr)
            Columns("A:B").AutoFit
        Else
            MsgBox "No links were found within the active workbook.", vbInformation, "KuTools for Excel"
        End If
    End Sub

    and

    (credit: https://www.thespreadsheetguru.com/t...al-links-excel )

    This little macro code will go through all the external links in your workbook and break the links. Note that this will not remove those pesky (hard-to-find) external links that may be hiding inside your charts. This code only addresses links that would show up inside the Edit Links dialog box (Data tab > Connections Group > Edit Links).

    Sub BreakExternalLinks()
    'PURPOSE: Breaks all external links that would show up in Excel's "Edit Links" Dialog Box
    'SOURCE: www.TheSpreadsheetGuru.com/The-Code-Vault
    
    Dim ExternalLinks As Variant
    Dim wb As Workbook
    Dim x As Long
    
    Set wb = ActiveWorkbook
    
    'Create an Array of all External Links stored in Workbook
      ExternalLinks = wb.LinkSources(Type:=xlLinkTypeExcelLinks)
    
    'Loop Through each External Link in ActiveWorkbook and Break it
      For x = 1 To UBound(ExternalLinks)
        wb.BreakLink Name:=ExternalLinks(x), Type:=xlLinkTypeExcelLinks
      Next x
    
    End Sub
    Click *Add Reputation to thank those who helped you. Ask if anything is not clear

  3. #3
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,973

    Re: Find cells that contain links to unavailable sources

    If you know the source file name. You can use CTRL + F to find and then replace the reference.

    Alternately, you could replace broken link(s) with some dummy file (in easy to find location such as C:\Temp\File.xlsx). Then find and replace.

    To search you would use something like 'DriveLetter:\Folder\*' Or if needed additional detail to specify broken link.
    Ex: 'C:\Temp\*' using above example when broken links are replaced with dummy file.
    Make sure you select look in->Formula.
    "Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something."
    ― Robert A. Heinlein

  4. #4
    Forum Contributor Mvaldesi's Avatar
    Join Date
    01-21-2011
    Location
    Plano, TX
    MS-Off Ver
    MS365 (PC) v.2108
    Posts
    271

    Re: Find cells that contain links to unavailable sources

    Thank you both; the VBA option worked well, but the Find/Replace avenue wasn't finding anything, even when I used advanced options to look in formulas. Oh well, is is resolved and you helps much appreciated!

  5. #5
    Forum Contributor
    Join Date
    08-16-2012
    Location
    Pendleton, OR
    MS-Off Ver
    Excel 2013
    Posts
    129

    Re: Find cells that contain links to unavailable sources

    I have had this problem repeatedly. It is usually in a chart that I have copied from another workbook. But today I have a link I just cannot find. The above macro and Find both come up empty.

    If I go to Data / Edit Links, I can always find the file name, but never the location of the link. I do not wish to break the link but want to replace it with the proper location from the current file. Why is it so hard to find these unwanted links?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 24
    Last Post: 03-21-2022, 08:01 AM
  2. Delete links to external sources and retain formulas in cells.
    By sfraneta in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-07-2014, 03:27 PM
  3. [SOLVED] 'Links to other sources' message cannot be resolved, cannot find the 'links'
    By Rob Kennedy in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-14-2014, 12:09 PM
  4. Deleting links to external sources
    By vioravis in forum Excel General
    Replies: 1
    Last Post: 07-30-2007, 09:44 AM
  5. advice:Links to other data sources
    By mr_teacher in forum Excel General
    Replies: 2
    Last Post: 05-16-2006, 09:30 AM
  6. Links to other data sources
    By Graham Haughs in forum Excel General
    Replies: 2
    Last Post: 02-25-2006, 10:00 AM
  7. my link menu is unavailable... I have created links and now the l.
    By Chad_Thermo in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 03-11-2005, 06:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1