+ Reply to Thread
Results 1 to 3 of 3

VBA to update filepath within a Vlookup based on date within a column

  1. #1
    Registered User
    Join Date
    10-20-2021
    Location
    Canada
    MS-Off Ver
    Microsoft Excel for Office 365 MSO - desktop version
    Posts
    16

    VBA to update filepath within a Vlookup based on date within a column

    Hi all,

    I am trying to get this VBA code working where it will reference some inputs within the file and use those inputs to update the filepath for where the Vlookup is referencing.
    I want it to use the date in Col H to automatically replace the date within the file path so it looks at the correct file.

    Vlookup which is working but requires manual updating daily:

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    From the above, I need the 2022-11 to be updated with the value in M6 and I need the 'Nov 01 2022' to be updated with the applicable value corresponding to that line in Col H, so that it is taking the correct month and date in order to reference the correct file.

    Trying to recreate this using VBA (with no experience):

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    I basically need Col I to replicate and replace Col D but by using the inputs from Col H and M.
    Any help would be much appreciated. Thank you.
    Attached Files Attached Files

  2. #2
    Forum Contributor Dante Amor's Avatar
    Join Date
    07-24-2020
    Location
    MEXICO
    MS-Off Ver
    Excel 2013
    Posts
    212

    Re: VBA to update filepath within a Vlookup based on date within a column

    In your OP you put this line:

    Private Sub Worksheet_Change(ByVal Target As Range)

    That means you need to put the formula every time a cell in the sheet is modified.
    But in your sheet column H has a formula, the Change event is not fired when the result of a formula changes, since the content, in this case a formula, did not change. What you are really changing is the content of column A, if so, then try the following.

    The event is activated when you modify the data in column A.

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    10-20-2021
    Location
    Canada
    MS-Off Ver
    Microsoft Excel for Office 365 MSO - desktop version
    Posts
    16

    Re: VBA to update filepath within a Vlookup based on date within a column

    Hi,

    Thank you so much. I really like how you went about this solution. I have it working (kind of) now, thanks to this.
    I have 3 more queries/concerns regarding this however:

    1. The file I sent in is a mock worksheet, however on the actual file Col A does have a formula in it, which is a direct reference to another sheet containing the dates. Is there no way around having this working on a col that contains formulas (that are updating/changing)?
    2. For the actual VLookup, I need the B2+1, to dynamically update with each cell, so it would go to B3+1, B4+1.....and so on. Is that possible within the macro?
    3. The formula and result is populating in Col I when I go into an individual cell and then hit return within the cell. However, it is not working when more than 1 date gets put into col A at a time, which is what will happen in this instance. There will be 24 new entries daily, all the same date, an entry for each hour. Is there a way to have this updated so it can handle multiple changes at once?

    Thanks again for your help and for looking into it.

+ 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. VBA to Update status Column based on recent date
    By edkawy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-17-2017, 10:06 AM
  2. VLOOKUP filepath function
    By malax in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-13-2015, 08:24 AM
  3. need to vlookup a date and Need to sum a column based on a date
    By Rossovich in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 12-10-2015, 02:01 PM
  4. [SOLVED] Would like date in column B to automatically update based on date in column A
    By LisaFull17 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-12-2014, 10:55 AM
  5. [SOLVED] Update filepath in a cell with VBA
    By MissDB in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 03-26-2014, 08:01 AM
  6. [SOLVED] Copying files from a selected filepath to a filepath mentioned in a worksheet's cell
    By subbby in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-10-2012, 03:59 PM
  7. Automatically update graph range based on date in column
    By basalisbury in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-05-2012, 12:03 PM

Tags for this Thread

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