Update all links in excel

Excel для Microsoft 365 Excel 2021 Excel 2019 Excel 2016 Excel 2013 Excel 2010 Excel 2007 Еще…Меньше

При создании внешних ссылок на другие книги (также называемые связями) вы можете управлять тем, обновляются ли они. Это важно, так как если кто-то другой изменяет значение связанной ячейки, Excel не обновляет ссылку и не отображает новое значение, если вы не сообщаете об этом.

Книга, которая содержит связи, называется книгой назначения, а книга, с которую она связана, называется книгой-источником. Вы можете связать несколько исходных книг с одной книгой.

Книга, содержащая связи

1. Destination workbook contains the external reference (link).

2. Внешняя ссылка (или ссылка) — это ссылка на ячейку или диапазон в книге-источнике.

3. Книга-источник содержит связанную ячейку или диапазон и фактическое значение, возвращаемого в 9-й книге.

Примечание: Количество книг, на которые можно ссылаться, не ограничивается, но обычно лучше использовать как можно меньше ссылок. В противном случае могут возникнуть проблемы с производительностью при пересчете формул. Кроме того, можно перекрестно связывать книги, где они выступают в качестве источника и назначения, но это может запутать и затруднить управление.

Когда исходные и назначения книг открываются на одном компьютере, связи обновляются автоматически. Когда конечная книга открыта, а книга-источник не открыта, в области сведений о документе возможно появление запроса на обновление связей. Можно задать режим вывода этого запроса, а также режим обновления всех связей без вывода запроса. Вы также можете обновить только определенные ссылки, если книга содержит несколько ссылок.

В следующих разделах рассматриваются наиболее распространенные варианты изменения связей.

  1. Закроем все исходные книги. Если одна книга-источник будет открыта, а остальные закрыты, обновления не будут одинаковыми.

  2. Откройте конечную книгу.

  3. Чтобы обновить связи, на панели доверия нажмите кнопку Обновить. Закройте планку доверия, если вы не хотите обновлять связи (на правом — X).

  1. Откройте книгу, содержащую связи.

  2. Перейдите в >запросы & подключения >ссылки.

    Подключения к данным

  3. Из списка Источник выберите связанный объект, который необходимо изменить.

    Вы можете выбрать отдельные книги, нажав CTRL+щелчок, или все их с помощью CTRL+A.

  4. Нажмите кнопку Обновить значения.

    Excel диалоговое окно "Изменение связей" в области "Запросы > данных" & connections > ссылки

  1. Найдите книгу, которую вы хотите использовать в качестве нового источника для внешней ссылки, и обратите внимание на ее расположение.

  2. В книге назначения выберите ячейку с внешней ссылкой, которую вы хотите изменить.

  3. В строка формул Значок кнопкинаймем ссылку на другую книгу, например C:Reports[Budget.xlsx], и замените ее расположением новой книги-источника.

Вы можете решить, обновляются ли ссылки в этой книге при открытии файла в соответствии с настройками пользователя, не обновляются при открытии файла или обновляются автоматически без запроса пользователя.

Предупреждение: Этот режим влияет на всех пользователей книги. Если отключить обновление связей и выдачу запроса, пользователи этой книги не будут знать, что данные устарели.

  1. Перейдите в >запросы & подключения >ссылки.

  2. Нажмите кнопку Запрос на обновление связей.

  3. Выберите один из следующих трех вариантов:

  • Разрешим пользователям отображать оповещение или нет

  • Не показывать оповещение и не обновлять автоматические ссылки

  • Не отображайте ссылки на оповещения и обновления.

Примечания: 

  • Параметры автоматического и ручного обновления. Для ссылок на формулы всегда установлено автоматическое обновление.

  • Даже если указать, что Excel не должен спрашивать, следует ли обновлять ссылки, вы по-прежнему будете уведомлены об их неработаете.

Открыв диалоговое окно Изменение связей (Запросы > данных & connections > Изменениесвязей), вы сможете работать с существующими ссылками несколькими вариантами. Вы можете выбрать отдельные книги, нажав CTRL+щелчок, или все их с помощью CTRL+A.

Excel диалоговое окно "Изменение связей" в области "Запросы > данных" & connections > ссылки

  • Обновление значений

    При этом будут обновлены все выбранные книги.

  • Изменить источник

    Этот параметр удобен, если нужно наказать существующие ссылки на другой источник. Например, у вас может быть книга за предыдущий год, и вам нужно будет навести указатель на новую книгу, когда начинается новый год. Если выбрать изменить источник, запустится диалоговое окно проводника, в котором можно найти новую книгу. Если книга состоит из двух листов, вам будет предложено указать, на какой из них должна указывать ссылка. Просто щелкните нужный лист и нажмите кнопку ОК.

    Примечание: Вы можете наказать книгу на себя, выбрав ее в диалоговом оке Изменение источника. В этом случае любая формула будет отсоединяться от исходной исходной книги.

  • Open Source

    Откроется книга-источник.

  • Разрыв связи

    Важно: При разрыве связей с источником все формулы, использующие источник, заменяются на их текущее значение. Например, ссылка =СУММ([Budget.xlsx]Годовой! C10:C25) будет преобразовано в сумму значений в книге-источнике. Так как это действие нельзя отменить, может потребоваться сначала сохранить версию файла.

    1. На вкладке Данные в группе Запросы & Connections нажмитекнопку Изменить связи.

    2. В списке Источник выберите связь, которую требуется разорвать.

      Вы можете выбрать отдельные книги, нажав CTRL+щелчок, или все их с помощью CTRL+A.

    3. Щелкните элемент Разорвать.

      Примечания: 

      • Если ссылка использовала определенное имя, оно не удаляется автоматически, поэтому вы также можете удалить его.

      • Чтобы удалить имя:

      • Если используется диапазон внешних данных, параметр запроса может также использовать данные из другой книги. Может потребоваться проверить и удалить эти типы связей.

      • На вкладке Формулы в группе Определенные имена нажмите кнопку Диспетчер имен.

      • В столбце Имя выберите имя, которое следует удалить, и нажмите кнопку Удалить.

  • Проверка состояния

    В области Изменение связей просто отображается уведомление о том, является ли связанная книга допустимым источником. Должно отображаться «ОК»,но если этого не происходит, необходимо проверить исходные книги. Во многих случаях при вырезании ссылки может быть перемещена или удалена книга-источник. Если книга по-прежнему существует, вы можете использовать параметр Изменить источник, чтобы перессылка книги.

  • Можно ли заменить одну формулу ее вычисляемой величиной?

    Да. Формулы в Excel, вместо которых вводится их значение, удаляются без возможности восстановления. Если вы случайно заменяете формулу значением и хотите ее восстановить, нажмите кнопку Отменить Кнопка отмены сразу после ввода или вжатия значения.

    1. Нажмите CTRL+C, чтобы скопировать формулу.

    2. Нажмите ALT+E+S+V, чтобы вировать формулу в качестве ее значения, или перейдите на главная> буфер обмена> в > Вэтом > в буфер обмена .

  • Что делать, если я не подключен к источнику?

    Нажмите кнопку Не обновлять. Обновление из источника при отсутствии подключения к нему невозможно. Например, если книга-источник расположена в сети, а подключение к сети отсутствует.

  • Я не хочу заменять текущие данные новыми

    Нажмите кнопку Не обновлять.

  • Я пытался обновить его в прошлый раз, но это занимает слишком много времени

    Нажмите кнопку Не обновлять. Если не требуется получение текущих данных, можно сэкономить время, не обновляя все связи. После открытия книги нажмите на вкладке Данные в группе Подключения кнопку Изменить связи, а затем обновите связи только с нужными исходными файлами.

  • Кто-то другой создал книгу, и я не знаю, почему я вижу этот запрос

    Щелкните Не обновлятьи обратитесь к владельцу книги. Вы также можете выяснить, какие связи находятся в книге. На вкладке Данные в группе Запросы & Connections нажмитекнопку Изменить связи.

  • Я отвечаю на запрос одинаково каждый раз и не хочу видеть его снова

    Можно ответить на запрос и запретить его вывод для этой книги в будущем.

    • Не отображать запрос и обновлять связи автоматически    

      Этот параметр влияет на все книги, которые открываются на компьютере. Пользователи, которые откроют книгу на другом компьютере, не будут затронуты.

      1. Откройте меню Файл, выберите раздел Параметры, а затем — Дополнительно.

      2. В разделе Общие снимите флажок Запрашивать об обновлении автоматических связей. Если этот флажок снят, связи будут обновляться автоматически (без выдачи запроса).

    • Одинаковый запрос для всех пользователей этой книги    

      Предупреждение: Этот режим влияет на всех пользователей книги. Если отключить обновление связей и выдачу запроса, пользователи этой книги не будут знать, что данные устарели.

      Перейдите в > запросы & подключения > Изменить ссылки > запросана запуск и выберите нужный параметр.)

      Примечание: При наличии разорванных связей будет появляться оповещение об этом.

  • Что делать, если я использую запрос с параметрами?

    1. Нажмите кнопку Не обновлять.

    2. Закройте конечную книгу.

    3. Откройте книгу-источник.

    4. Откройте конечную книгу.

    5. Нажмите кнопку Обновить.

    Связь с параметрическим запросом нельзя обновить без открытия книги-источника.

  • Почему я не могу выбрать параметр «Вручную» в качестве параметра обновления для определенной внешней ссылки?

    Для ссылок на формулы всегда установлено автоматическое.

Дополнительные сведения

Вы всегда можете задать вопрос специалисту Excel Tech Community или попросить помощи в сообществе Answers community.

Нужна дополнительная помощь?

Manually update only some of the links to other workbooks

  1. Open the workbook that contains the links.
  2. Go to Data > Queries & Connections > Edit Links.
  3. In the Source list, click the linked object that you want to update. You can select individual workbooks with Ctrl+click, or all of them with Ctrl+A.
  4. Click Update Values.

Contents

  • 1 How do I get Excel to automatically update links?
  • 2 Why can I not update links in Excel?
  • 3 How do you update links to current workbook?
  • 4 How do I find links to external sources in Excel?
  • 5 Why are my links disabled in Excel?
  • 6 How do you break links in Excel without opening file?
  • 7 How do you find external links in Excel and remove them?
  • 8 How do I find and remove links in Excel?
  • 9 How do you fix multiple broken links in Excel?
  • 10 How do I enable linked data in Excel for Mac?
  • 11 How do you remove We can’t update some of the links in your workbook?
  • 12 How do I find broken links in Excel?
  • 13 Why is break links not working?
  • 14 How do I unlink in Excel?
  • 15 How do you refresh stock in Excel?
  • 16 How do you add linked Data in Excel?

How do I get Excel to automatically update links?

Instead, you should enable automatic link updates in Excel 2013 by selecting File, Options, Trust Center, Trust Center Settings, External Content, and under the section labeled Security settings for Workbook Links, select Enable automatic update for all Workbook Links, and then click OK.

Why can I not update links in Excel?

To suppress the message and to automatically update the links when you open a workbook in Excel, follow these steps:

  1. Select File > Options > Advanced.
  2. Under General, click to clear the Ask to update automatic links check box.

How do you update links to current workbook?

Click Edit Links -> Change source, browse to find the current file which is open on your system. Click on the filename and click OK. All the links will be updated to the new file.

How do I find links to external sources in Excel?

Find External Links using Edit Links Option

  1. Go to the Data Tab.
  2. In the Connections group, click on Edit Links. It opens the Edit Links dialog box will list all the workbooks that are being referenced.
  3. Click on Break Links to convert all linked cells to values.

Why are my links disabled in Excel?

Disable the updating of these links in the Excel client, by going to Excel Options > Advanced > General > Web Options > File names and locations > and uncheck Update links on save. If you disable this, the hyperlinks will not be updated in the Excel client and therefore will not be broken in Excel Online.

How do you break links in Excel without opening file?

Break a link

  1. On the Data tab, in the Connections group, click Edit Links. Note: The Edit Links command is unavailable if your file does not contain linked information.
  2. In the Source list, click the link that you want to break.
  3. Click Break Link.

How do you find external links in Excel and remove them?

When you see the Edit Links dialog appears, you will see a listing of all the external Excel files that are getting data pulled from them. To remove/break the link, simply select the rows you wish to remove and click the Break Link button.

How do I find and remove links in Excel?

Using the Context Menu to Remove the Hyperlink Option

  1. To remove multiple hyperlinks from an Excel spreadsheet, hold the Ctrl key and select the cells.
  2. Then you can select all the cells that include the links and click the Remove Hyperlink option.

How do you fix multiple broken links in Excel?

How to edit multiple hyperlinks at a time

  1. Press Ctrl + H to open the Replace tab of the Find and Replace dialog.
  2. In the right-hand part of the dialog box, click the Options button.
  3. In the Find what box, type the text you want to change (“old-website.com” in this example).

How do I enable linked data in Excel for Mac?

To see if your Excel 365 (Office 365 customers only) has this feature, go to the Data tab and look for the new section with Stocks and Geography icons. Because it’s an external link, these Linked Data Types come with a standard security warning. Click Enable Content to allow Linked Data Types to update.

How do you remove We can’t update some of the links in your workbook?

How to disable update links message when open a workbook?

  1. Disable update links message with Edit Links feature.
  2. Disable update links message with Excel Options.
  3. Click Data > Edit Links, see screenshot:
  4. In the Edit Links dialog box, click Startup Prompt button at the bottom, see screenshot:

How do I find broken links in Excel?

Find and fix broken links in Excel

  1. On the Data tab, in the Queries &Connections group, click the Edit Links button.
  2. In the Edit Links dialog box, you can see a list of all external sources that your current workbook is referring to.
  3. When the information gets updated, review the status of each link.

Why is break links not working?

a) When the active sheet is protected and you try to edit links the BREAK LINK button will be grayed out. You will need to unprotect this sheet or go to another sheet before you try and break links. b) If a cell within a protected sheet is linked to an external file then you won’t be able to break links.

How do I unlink in Excel?

Here is an easy way to unlink them all at once.

  1. Go to a data table.
  2. Drop the Edit menu and choose links.
  3. Click on the first linked object in the list.
  4. Hold shift and click on the last linked object.
  5. Click ‘Break Link”.
  6. Confirm that you want to break the link.

How do you refresh stock in Excel?

Excel will refresh the stock quotes at any time. One way to do this is to use the Data > Refresh All command. Another way is to right-click any of the company names and select Refresh, or, Data Type > Refresh. Excel retrieves updated information and refreshes the table accordingly.

How do you add linked Data in Excel?

In the Excel app, go to Insert > Get Add-ins, search for “Wolfram”, and then select Add for “Data types by Wolfram.” For more information, see Wolfram data types now available to Enterprises. e. Use the up-to-date Excel app or Excel for the web.

Содержание

  1. Обновление всех связей в книге
  2. Описание проблемы
  3. Решение
  4. Принцип работы программы
  5. How to make Excel update links using VBA
  6. How to make Excel update links
  7. Метод Workbook.UpdateLink (Excel)
  8. Синтаксис
  9. Параметры
  10. Замечания
  11. Пример
  12. Поддержка и обратная связь
  13. Update all links VBA
  14. jeremy1026@yahoo.com
  15. Excel Facts
  16. Will from London
  17. jeremy1026@yahoo.com
  18. Will from London
  19. Mike Reutter
  20. Will from London
  21. Pixelpusher
  22. Will from London

Обновление всех связей в книге

Описание проблемы

Если создаваемый файл Excel ссылается на несколько книг, в которых часто меняются данные, то возникает потребность в их периодическом обновлении. Конечно, можно обновить все связи вручную по одной или перезапустить файл обновив все связи автоматически. Однако что делать если ссылок на файлы очень много? Перебирать по одной связи очень долго. А что делать если используются функции СУММЕСЛИ или СУММЕСЛИМН. В этом случае формулы не пересчитаются до тех пор пока файл из которого берутся данные закрыт. Держать с десяток файлов открытыми тоже не решение.

Решение

Надстройка VBA-Excel содержит макрос с помощью которого можно быстро обновить все связи и пересчитать формулы. Для этого необходимо выполнить следующие действия:

  1. Открыть вкладку VBA-Excel на ленте.
  2. В группе Ячейки и диапазоны найти пункт меню Связи и в раскрывающемся списке выбрать Обновить все связи.

Принцип работы программы

Макрос проходит по всем связям, которые имеются в книге и последовательно открывает их в фоновом режиме. В момент открытия файла пересчитываются формулы. Файлы (связи) открываются в режиме для чтения и не влияют на одновременную работу с ними других пользователей. Процедура обновления практически незаметна (если конечно ваши файлы не по 10-15 Мб).

Источник

How to make Excel update links using VBA

Excel doesn’t automatically update any external links in your workbooks and this can become a hassle if it’s something happening frequently. In this article, we’re going to show you how to make Excel update links automatically using VBA.

How to make Excel update links

Links can be updated using a special method named UpdateLink under the Workbook object. The UpdateLink method takes two optional arguments:

  • Name: The name of the Microsoft Excel workbook or DDE/OLE link to be updated, as returned from the LinkSources
  • Type: One of the parameters for XlLinkType is specifying the type of link. Use xlLinkTypeExcelLinks for Excel files and xlLinkTypeOLELinks for OLE sources.

To update all links in the active workbook, use ActiveWorkbook.LinkSources for the Name and xlExcelLinks for Type arguments.

Since the default value of the Type parameter is xlExcelLinks, you can omit that argument as well.

You can use codes in two ways:

In the Module method, you need to add the module into the workbook or the add-in file. Copy and paste the code into the module to run it. The main advantage of the module method is that it allows saving the code in the file, so that it can be used again later. Furthermore, the subroutines in modules can be used by icons in the menu ribbons or keyboard shortcuts. Remember to save your file in either XLSM or XLAM format to save your VBA code.

The Immediate Window method, on the other hand, is essentially a quick and dirty method where you can simply copy and paste the code into the Immediate Window and press the Enter key to run it. Unfortunately, any code you use in the Immediate Window will not be saved. Also note that icons and keyboard shortcuts will not be available.

Источник

Метод Workbook.UpdateLink (Excel)

Обновления ссылку Microsoft Excel, DDE или OLE (или ссылки).

Синтаксис

expression. UpdateLink (имя, тип)

Выражение Переменная, представляющая объект Workbook .

Параметры

Имя Обязательный или необязательный Тип данных Описание
Name Необязательно заполнять. Variant Имя обновляемой ссылки Microsoft Excel или DDE/OLE, возвращенное методом LinkSources .
Type Необязательный Variant Одна из констант XlLinkType , указывающая тип ссылки.

Замечания

Если метод UpdateLink вызывается без каких-либо параметров, Excel по умолчанию обновляет все ссылки на лист.

Пример

В этом примере обновляются все ссылки в активной книге.

Поддержка и обратная связь

Есть вопросы или отзывы, касающиеся Office VBA или этой статьи? Руководство по другим способам получения поддержки и отправки отзывов см. в статье Поддержка Office VBA и обратная связь.

Источник

Update all links VBA

jeremy1026@yahoo.com

New Member

A while ago I found a short VBA program on the internet that updates all the externals links in a workbook. It was much better than using Edit—>Links. selecting all the source files and clicking «Update All» since I found that, at least in earlier versions of Excel, it didn’t update all the links.

Does anyone have a VBA macro that will update all external links in the current workbook?

Excel Facts

Will from London

Board Regular

I’ve made a workbook in the office that is capable of updating multiple links (in other workbooks). It can update multiple workbooks (one after the other). To use it you enter the details using a UserForm. The data to enter is effectively:

‘Path’, ‘filename’, ‘change links from’ and ‘change links to’

If this would be of use I’ll e-mail a copy to my home address and I could then post it on here.

jeremy1026@yahoo.com

New Member

Will from London

Board Regular

First a sheet called «Control» needs to be set up with the following ranges:
fileNames D16:D65536
inputRange C16:H65536
pathNames C16:C65536

I put the following headings in C15:H15
Path, Filename, Change Links From, Change Links To, Ignore or Undo, Result.

I created a User Form called update_links_form with the following command buttons (Captions in brackets after them): allFiles (Yes), okButton (OK), cancelButton (Cancel), locationBrowse (Browse…), oldLinkBrowse (Browse…), and newLinkBrowse (Browse…).
There are three text boxes called: locationFileUpdate, oldLink and newLink.
There are two check boxes called: includeSubFolders and addFurtherRecords

I should mention that the Yes button is next to the question “Include all files in this location?”

locationBrow = Application.GetOpenFilename
If locationBrow = False Then locationBrow = «»
update_links_form.locationFileUpdate = locationBrow

End Sub
Private Sub allFiles_click()

If update_links_form.locationFileUpdate = «» Then GoTo lastLine

allFilesLocation = update_links_form.locationFileUpdate
Do While Right(allFilesLocation, 1) <> «»
allFilesLocation = Left(allFilesLocation, Len(allFilesLocation) — 1)
Loop
update_links_form.locationFileUpdate = allFilesLocation

lastLine:
End Sub
Private Sub cancelButton_click()

End Sub
Private Sub oldLinkBrowse_click()

oldLinkBrow = Application.GetOpenFilename
If oldLinkBrow = False Then oldLinkBrow = «»
update_links_form.oldLink = oldLinkBrow

End Sub
Private Sub newLinkBrowse_click()

newLinkBrow = Application.GetOpenFilename
If newLinkBrow = False Then newLinkBrow = «»
update_links_form.newLink = newLinkBrow

End Sub
Public Sub okButton_click()

Option Explicit
Sub ReadFiles()

‘Written by Will 15/10/04

Dim fileName As String
Dim locationPath As String
Dim counter As Integer
Dim fileCells As Object
Dim allFiles As Integer
Dim locationPathFile As String
Dim locationPathFile1 As String
Dim pathExtract As String
Dim oldLink As String
Dim newLink As String
Dim subFolders As Boolean
Dim addFurther As Boolean
Dim endRow As Long
Dim i As Long
Dim startPoint As Long
Dim numberToCheck As Long
Dim deleteRow As Boolean

allFiles = 0
counter = 0

Load update_links_form
update_links_form.locationFileUpdate = «»
update_links_form.oldLink = «»
update_links_form.newLink = «»
update_links_form.allFiles = False
update_links_form.addFurtherRecords = False

Application.ScreenUpdating = False
update_links_form.Show

locationPathFile = update_links_form.locationFileUpdate
oldLink = update_links_form.oldLink
newLink = update_links_form.newLink

subFolders = update_links_form.includeSubFolders
addFurther = update_links_form.addFurtherRecords

If oldLink = «» Then GoTo lastLine

If ActiveSheet.Range(«C16»).Value = «» Then ActiveSheet.Range(«C16»).Select

If ActiveSheet.Range(«C16»).Value <> «» Then
ActiveSheet.Range(«C15»).Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Range(«A1»).Select
End If

Do While Right(locationPath, 1) <> «»
locationPath = Left(locationPath, Len(locationPath) — 1)
Loop

ActiveCell.Value = locationPath
ActiveCell.Offset(0, 2).Value = update_links_form.oldLink
ActiveCell.Offset(0, 3).Value = update_links_form.newLink
If locationPath = locationPathFile Then allFiles = 1

If allFiles = 1 Then
ActiveCell.Offset(0, 1).Select

startPoint = ActiveCell.Row — 16

With Application.FileSearch
.NewSearch
.LookIn = locationPath
.FileType = msoFileTypeAllFiles
.SearchSubFolders = subFolders ‘boolean defined above
.Execute
endRow = .FoundFiles.Count
For i = 1 To endRow
fileName = .FoundFiles(i)
pathExtract = fileName
Do While Right(pathExtract, 1) <> «»
pathExtract = Left(pathExtract, Len(pathExtract) — 1)
Loop
Sheets(«Control»).Range(«pathNames»).Cells(i + startPoint, 1).Value = pathExtract
fileName = Right(fileName, Len(fileName) — Len(pathExtract))
Sheets(«Control»).Range(«fileNames»).Cells(i + startPoint, 1).Value = fileName
Next i
End With

If allFiles = 0 Then
locationPathFile1 = locationPathFile

Do While ActiveCell.Value & locationPathFile1 <> locationPathFile
locationPathFile1 = Right(locationPathFile1, Len(locationPathFile1) — 1)
Loop
ActiveCell.Offset(0, 1).Value = locationPathFile1
End If

If ActiveSheet.Range(«D17»).Value <> «» And allFiles = 1 Then
Selection.End(xlDown).Select
ActiveCell.Offset(0, 1).Range(«A1:B1»).Select
Range(Selection, Selection.End(xlUp)).Select
Selection.FillDown
End If

ActiveSheet.Range(«C15»).Select
Application.ScreenUpdating = True

If addFurther = True Then GoTo DisplayForm

‘to tidy up entries
Application.ScreenUpdating = False

Selection.End(xlDown).Select
numberToCheck = ActiveCell.Row — 15
Sheets(«Control»).Range(«C16»).Select

For i = 1 To numberToCheck
deleteRow = False

If ActiveCell.Value & ActiveCell.Offset(0, 1).Value = _
ActiveWorkbook.FullName Then deleteRow = True
If Right(ActiveCell.Offset(0, 1).Value, 4) <> «.xls» Then deleteRow = True
If Right(ActiveCell.Offset(0, 2).Value, 4) <> «.xls» Then deleteRow = True
If Right(ActiveCell.Offset(0, 3).Value, 4) <> «.xls» Then deleteRow = True

If deleteRow = True Then ActiveCell.EntireRow.delete
If deleteRow = False Then ActiveCell.Offset(1, 0).Select

Next i
Application.ScreenUpdating = True

lastLine:
End Sub
Sub updateLinks()

Dim numberToDo As Single
Dim counter As Single
Dim fileToOpen As String
Dim oldLink As String
Dim newLink As String
Dim areYouSure As Integer
Dim thisSheet As String

areYouSure = MsgBox(«Are you sure you wish to proceed?», vbYesNo + vbQuestion)

If areYouSure = vbNo Then GoTo lastLine

ActiveSheet.Range(«C15»).Select
Selection.End(xlDown).Select
number To Do = ActiveCell.Row — 15

For counter = 1 To numberToDo
Application.StatusBar = «Processing update » & counter & » of » & numberToDo & «.»

If ActiveSheet.Range(«G» & counter + 15).Value = «Undo» _
Or ActiveSheet.Range(«G» & counter + 15).Value = «undo» Then
fileToOpen = ActiveSheet.Range(«C» & counter + 15).Value _
& ActiveSheet.Range(«D» & counter + 15).Value
oldLink = ActiveSheet.Range(«F» & counter + 15).Value
newLink = ActiveSheet.Range(«E» & counter + 15).Value
GoTo updatePoint
End If

If ActiveSheet.Range(«G» & counter + 15).Value <> «» Then
ActiveSheet.Range(«H» & counter + 15).Value = «Omitted»
GoTo nextRecord
End If
fileToOpen = ActiveSheet.Range(«C» & counter + 15).Value _
& ActiveSheet.Range(«D» & counter + 15).Value
oldLink = ActiveSheet.Range(«E» & counter + 15).Value
newLink = ActiveSheet.Range(«F» & counter + 15).Value

updatePoint:
On Error GoTo 0
On Error GoTo errorHandler
Workbooks.Open fileName:=fileToOpen, updateLinks:=0
‘this is the only bit that actually changes anything
Application.Calculation = xlAutomatic
ActiveWorkbook.Change LinkName:=oldLink, NewName:=newLink, Type:=xlExcelLinks
Application.Calculation = xlCalculationManual

ActiveWorkbook.Close (True) ‘True causes the file to be saved.

If ActiveSheet.Range(«G» & counter + 15).Value = «Undo» Then
ActiveSheet.Range(«H» & counter + 15).Value = «Undone»
GoTo nextRecord
End If
ActiveSheet.Range(«H» & counter + 15).Value = «Updated»
nextRecord:
Next counter

MsgBox «Macro has finshed running», vbOKOnly, «Update Links Macro»

errorHandler:
If ActiveWorkbook.FullName <> thisSheet Then ActiveWorkbook.Close (False)
ActiveSheet.Range(«H» & counter + 15).Value = «Error»
Application.Calculation = xlCalculationManual
Resume nextRecord
Application.ScreenUpdating = True

End Sub
Sub deleteEntries()

End Sub

Hope this solves the problem.

Mike Reutter

New Member

Will from London

Board Regular

I’ve updated the whole thing since I posted it (and there are a couple of minor problems with the code above because I didn’t use the BB code formatter correctly) so it’s probably more efficient if you want this if you drop me a PM with your e-mail address and I can then send the whole thing as an attachment.

Anyone else is more than welcome to do the same.

Pixelpusher

Board Regular

Will from London

Hi Will from London I hope you are still around as your link updater might be the answer I am looking for

I have a problem to solve in that a vlookup table is linked to a master lookup table that can be updated because there are multiple sheets with the same table in them, so is there a way to update the master table and not have a warning msg ‘do you want to update links to another workbook’ when you open a sheet with the table in and not have to save that sheet also, I hope that makes sense.

Will from London

Board Regular

Firstly let me see if I’m understanding the issue:
1. You have a master workbook which contains a table.
2. There are a certain number of other workbooks that extract information from this central table using VLOOKUP etc.
3. When you update information in the master workbook you would like all the information in the dependent tables to automatically update.
4. Although you change data within the master table you do not actually change the destination (as in the cell references within the master workbook) of the links.

Unfortunately this is not what my workbook described above does. A more apt title to this thread would include «alter» rather than «update» because, using your situation, it would allow you to effectively switch to a new master workbook at the click of a mouse. The links would still point to say cell A1 on Sheet1 but instead of pointing to masterA.xls they’d be pointing to masterB.xls.

If your situation is as described above I would be inclined to opt for a slightly different approach.

1. I would create (within the master workbook but on a new sheet) a list of the path and file names of all the workbooks that you wish to update every time you update the master workbook.
2. Then I would have a button linked to a macro that recalculated and saved the master worksheet (but kept it open) and then went through the list of other workbooks in turn. The macro would then update all the links within your dependent workbooks recalculate and then save them. (This process generally works more quickly with the master workbook open anyway).
3. As a sort of audit trail the macro could then add the date and time that each dependent workbook was saved next to its name on the list in the master workspace.

The solution I have described can be built so that the warning messages don’t appear, although you’d probably want a message if somebody else had one of the dependent workspaces open at the time you ran the macro or if the links were corrupt in some way.

If writing VBA code is not a strong point, or you’re not sure where to start, let me know and I’ll see if I can point you in the right direction.

Источник

See all How-To Articles

This tutorial demonstrates how to update links automatically in Excel.

update links automatically 12

Update Links Automatically

In Excel, you can link cells’ values to cells from another workbook. With both files open, values in the linked workbook change as you update values in the source workbook. Say you have the value File 2.xlsx with a value of 20 in cell A1 and File 1.xlsx, in which cell A1 is linked to cell A1 from File 2.xlsx.

update links automatically 1

When you change values in the source file and open the target file, you’ll be asked to confirm whether you want to update values. This is the default setting in Excel, which can be changed to automatically update all links when you open the file.

update links automatically 7

If you want to update the value automatically when you open the workbook File 1.xlsx, follow these steps:

  1. Change the value in the source file (for example, change cell A1 from 11 to 20), so you can see the changes later in File 1.xlsx.

update links automatically 2

  1. Now go to the target file (File 1.xlsx), and in the Ribbon, go to File > Options.

update links automatically 3

  1. In the Excel Options window, go to the Trust Center tab, and choose Trust Center Settings…

update links automatically 4

  1. In the Trust Center Settings window, go to the External Content tab, select Enable automatic update for all Workbook Links, and click OK.

update links automatically 5

  1. Now in the Ribbon, go to Data > Edit Links.

update links automatically 8

  1. In the Edit Links window, go to Startup Prompt…

update links automatically 9

  1. In the pop-up window, select Don’t display the alert and update links, and click OK.

update links automatically 10

  1. You’re back in the Edit Links window, click Close to exit.

update links automatically 11

As a result, you’ve enabled automatic update of links and disabled the prompt message on opening the file. So, if you now open again the linked workbook (File 1.xlsx), the value in cell A1 automatically updates with the value of cell A1 in File 2.xlsx (20).

update links automatically 12

Update Links in Google Sheets

Google Sheets files can only link to URLs externally, so links are updated in real time.

Please Note:
This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Updating Links.

Written by Allen Wyatt (last updated April 26, 2022)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365


Normally, if you have linked information in your workbook, the information is updated whenever you open the workbook. There may be times when you need to update the links manually, however. You do this by following these steps:

  1. Display the Data tab of the ribbon.
  2. In the Connections group, click the Edit Links tool. Excel displays the Edit Links dialog box(Excel 2007, Excel 2010, and Excel 2013). If you are using Excel 2016 or a later version, the Edit Links tool is found in the Queries & Connections group. (See Figure 1.)
  3. Figure 1. The Edit Links dialog box.

  4. Select the link you want to update.
  5. Click on Update Values.
  6. Repeat steps 3 and 4 for any other links you want to update.
  7. Click on Close.

ExcelTips is your source for cost-effective Microsoft Excel training.
This tip (7556) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365. You can find a version of this tip for the older menu interface of Excel here: Updating Links.

Author Bio

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. Learn more about Allen…

MORE FROM ALLEN

Adding a Little Color

The normal way to change the color of selected text is through the use of the Font Color tool. If you have to use the …

Discover More

Highlighting Text Using the Keyboard Only

Highlighting text, using the Highlight tool, is a great way to mark up a document. Normally you need to use the toolbar …

Discover More

Fields in Footnotes Won’t Update Automatically

Fields can be very helpful for including dynamic information in your documents, such as cross-references. It can be …

Discover More

More ExcelTips (ribbon)

Changing Huge Numbers of Hyperlinks

Need to change the various targets of a group of hyperlinks? Getting at the underlying link can seem challenging, but it …

Discover More

Don’t Update Links to Other Programs

If you have links in your workbook to data in other workbooks, you may want to control whether Excel updates those links …

Discover More

Unwanted Hyperlinks

Tired of having Excel convert what you type into active hyperlinks? Here are things you can do to undo Excel’s …

Discover More

Понравилась статья? Поделить с друзьями:
  • Update all field in word
  • Update all cells excel
  • Unhide excel all sheet
  • Unhide columns in excel column a
  • Unhide all column in excel