I have a file with > 50 external links .. What I would like to do is print all of these external links on a worksheet, and update them all to their values.
Any ideas?
Thanks in advance.
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
Home » Forums » AskWoody support » Productivity software by function » MS Excel and spreadsheet help » Converting external links to values
I don’t know an easy way to do that, but here is the hard way, plus some ideas !
jlkirk,
“I have a file with > 50 external links”: What format is the file (Word, Excel, txt)? Can we assume that these are URL addresses or data links?
“What I would like to do is print all of these external links on a worksheet”: Print them to a worksheet (import) or from a worksheet to paper?
“update them all to their values”: Does this mean add hyperlinks to the text?
Could you please post a sample?
The external links are data links to other Excel files;
I would like to print them to a new worksheet in the file that has the links embedded;
Update to all of their values = instead of a link, convert the linked data to their absolute values, so, when all is said and done, there should not be any more external data links in the file, but, instead, the values.
JL,
Unless I’m missing something why not just copy/paste special values? HTH :cheers:
JL,
Ok, here’s some VBA that will operate on the currently active sheet and replace all links with the value.
Option Explicit Sub ReplaceLinkedCellsWithValue() Dim rngFound As Range Dim zFirstFound As String [A1].Select Set rngFound = Cells.Find(What:="[*]", _ After:=ActiveCell, _ LookIn:=xlFormulas, _ LookAt:=xlPart, _ SearchOrder:=xlByColumns, _ SearchDirection:=xlNext, _ MatchCase:=False, _ SearchFormat:=False) Do While (Not (rngFound Is Nothing)) rngFound.Copy rngFound.PasteSpecial xlPasteValues Application.CutCopyMode = False Set rngFound = Cells.FindNext(After:=rngFound) Loop End Sub 'ReplaceLinkedCellsWithValue
Remember to ALWAYS test on a COPY of your workbook!
HTH :cheers:
Hi jkirk
These routines may help.
The first assumes you have a sheet named [Links] in your workbook.
This is used to list the links.
Sub listExcelLinks() zLinks = ThisWorkbook.LinkSources 'create array list of links If Not IsEmpty(zLinks) Then 'check that links are present Sheets("Links").Select 'switch to sheet to be used for listing Cells.Clear 'clear any entries on sheet first [a1] = "Link Number" 'add a heading label in column [A] [b1] = "Link source" 'add a heading label in column [B] For I = 1 To UBound(zLinks) 'loop through all entries in the array Cells(I + 1, "A") = I 'put link reference number in col [A] Cells(I + 1, "B") = zLinks(I) 'put link source (filename and path) in col [B] Next I 'process next array entry [A:B].EntireColumn.AutoFit 'set column widths to fit the entries End If 'end of test for links End Sub
Before you break all links, you may want to get the lastest values first.
This routine will refresh all values
Sub updateAllExcelLinks() On Error Resume Next 'set error trap for next line.. ThisWorkbook.UpdateLink Name:=ThisWorkbook.LinkSources On Error GoTo 0 'reset error trap End Sub
This routine will then remove all links, leaving the current values only.
Sub removeAllExcelLinks() zLinks = ThisWorkbook.LinkSources 'create array list of links For I = 1 To UBound(zLinks) 'loop through all entries in the array ThisWorkbook.BreakLink zLinks(I), 1 'break Excel link Next I 'process next link End Sub
zeddy
Hi Maud
Very good advice.
Now, as my note said, it assumes you have a sheet named [Links] in the workbook to be used for listing the workbook links. And, just to be sure, it makes sure that particular sheet [Links] is ’empty’, before creating the list.
A better solution would probably be to have vba add a new sheet, and then use that new sheet for the list of links. I thought my sloppy requirement for a pre-existing sheet named [Links] might tempt you to provide a more elegant version!
Also, we could have a third column in the listing, say ‘Status’, which could be used to check whether the excel source file ‘exists’ or is ‘missing’ (using the vba Dir command to check etc etc)
zeddy
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.