Results 1 to 4 of 4

Add vlookup data links top external closed workbook

Threaded View

  1. #1
    Registered User
    Join Date
    05-10-2013
    Location
    london
    MS-Off Ver
    Excel 2010
    Posts
    68

    Add vlookup data links top external closed workbook

    Hi all,

    Please see below.
    I am adding a formula to a spreadsheet, that looks up a section in a closed workbook. This will always be the prior working day
    - So if today is the 23rd, then the link should connect to the 20th - as 23rd is Monday, prior date is Friday 20th)
    The user has to update the link manually, as the file date is not changing. - i.e. Bank Rec 16 Sept


     .Formula = "=IFERROR(IF(ISBLANK($B3),"""",VLOOKUP(A3,'K:\Document Share\Reconciliation Work\EP Balance Daily Reconciliation\[Bank Rec 16 Sept.xlsm]Balances'!$A:$T,20,FALSE)),)"
     .AutoFill Destination:=Range("T3:T" & lastrow)


    Below, is my attempt to automate this

    Create link to the files folder
     
     'link to previous day rec. we are wanting to have "mainPath", so any changes to the folder name are made in the spreadsheet, not code.
     mainPath1 = ActiveWorkbook.Worksheets("Instructions").Range("d17 ").Value
     Set wbCopy = Workbooks.Open(mainPath)
    
    mainPath is - K:\Document Share\Reconciliation Work\Balance Daily Reconciliation\Bank Rec 20 Sep.xlsm
    Adding code for link
    When the VBA adds the following, it asks you to make the link (see attached screen shot - naming convention is changed from Sept to Sep)


       
    TDate = Date
    If Weekday(Date) = vbMonday Then
    
        TDate = TDate - 3
    Else: TDate = TDate - 1
    End If
    
          With Range("T3")
       .Formula = "=IFERROR(IF(ISBLANK($B3),"""",VLOOKUP(A3,'mainpath1\[Bank Rec 16 Sept.xlsm]Balances'!$A:$T,20,FALSE)),)"
     .AutoFill Destination:=Range("T3:T" & lastrow)
    So, How do I make [Bank Rec 16 Sep.xlsm] become [Bank rec Tdate.xlsm] and not try to auto update the link during the macro process?


    Many many thanks
    Attached Images Attached Images

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] External Links result in #VALUE errors when external file is closed
    By ziggyztz in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-24-2019, 04:41 PM
  2. [SOLVED] VBA for Every 15 min workbook will open and save data and close (for external links update
    By rajeshn_in in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-02-2017, 06:52 PM
  3. Replies: 0
    Last Post: 04-02-2014, 03:25 PM
  4. Replies: 0
    Last Post: 03-27-2014, 12:38 PM
  5. Possible to have a shared workbook update external data links?
    By scottatbuckman in forum Excel General
    Replies: 1
    Last Post: 03-03-2014, 12:38 AM
  6. [SOLVED] External links break after the source workbook is closed
    By jankee in forum Excel General
    Replies: 6
    Last Post: 05-21-2013, 09:14 AM
  7. Dynamic VLOOKUP from external, closed workbooks
    By dolik in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-13-2005, 08:44 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