+ Reply to Thread
Results 1 to 3 of 3

Automatically change all external links based on a cell value when an Excel file is open

  1. #1
    Forum Contributor
    Join Date
    01-15-2013
    Location
    London
    MS-Off Ver
    Excel 2003, 2007, 2010, 2019
    Posts
    436

    Automatically change all external links based on a cell value when an Excel file is open

    Dear all,

    I have an Excel file which has a few external links such as: ='C:\Data\R_2017_01_01.xlsx'!Tickers

    Here R_2017_01_01 is the Excel file name (2017_01_01 is a date).

    Assume now the date is 2017_01_02. There will be a file R_2017_01_02. Now I want to automatically change the link from R_2017_01_01 to R_2017_01_02 when the Excel file is opened. Next time, for any date, I want this link change to happen automatically when the file is opened.

    Note: Cell A1 gives the date for the old link (e.g. 2017_01_01), and cell B1 gives the date for the new link (2017_01_02).
    Last edited by billj; 01-10-2017 at 06:15 PM.

  2. #2
    Forum Contributor
    Join Date
    01-15-2013
    Location
    London
    MS-Off Ver
    Excel 2003, 2007, 2010, 2019
    Posts
    436

    Re: Automatically change all external links based on a cell value when an Excel file is op

    I made a macro below which works:

    Please Login or Register  to view this content.
    Can we enhance this code to allow all links with keywords OldDate to be changed to new links with keywords NewDate?

    Suppress any warning message if any new link cannot be found

  3. #3
    Forum Contributor
    Join Date
    01-15-2013
    Location
    London
    MS-Off Ver
    Excel 2003, 2007, 2010, 2019
    Posts
    436

    Re: Automatically change all external links based on a cell value when an Excel file is op

    I think the task is straightforward: for all links containing text given in cell A1, do replacement: replace the text with the value in cell B1. For example, cell A1 has text "2017_01_01", cell B1 has text "2017_01_02", then replace 2017_01_01 with 2017_01_02 for all links if they contain that text.

+ 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: 2
    Last Post: 12-17-2021, 08:19 AM
  2. [SOLVED] Automatically open a workbook and update external links
    By billj in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-10-2016, 11:56 AM
  3. External Data from Microsoft Query - Excel File - Causes external file to open.
    By lee1000d in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-25-2015, 02:25 PM
  4. Replies: 1
    Last Post: 03-19-2015, 08:39 PM
  5. Replies: 1
    Last Post: 03-27-2013, 08:33 AM
  6. External File(s) referenced and file links change based on row cell.
    By Jimmydageek in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-23-2009, 02:59 PM
  7. Replies: 12
    Last Post: 06-30-2009, 11:24 AM

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