paun_shotts
New Member
- Joined
- Nov 4, 2021
- Messages
- 41
- Office Version
- 2013
- Platform
- Windows
I have a workbook that lists products we sell, and how many of each product we have in stock, on order, on backorder for customers, and how many we have sold of each product on any given month over multiple financial years.
I export a report from our system for the current financial year, into this 2024data.xls file.
Then I open the main workbook, and have some VBA code that determines the current financial year, and then it opens that corresponding workbook, which allows the VLOOKUPs to update in the main workbook, then the VBA code closes the 2024data.xls workbook after the values have been updated.
What I want to do is have a dynamic VLOOKUP, or an alternative solution, I have tried the INDIRECT VLOOKUP but that requires the other workbook to be open the whole time. This will NOT work for me.
If the financial year is FY23/24 (I call it 2024 in my workbook, FY24/25 would be called 2025 etc.) Then I want the VLOOKUP to be looking in 2024data.xls, if the financial year is 2025, then VLOOKUP in 2025data.xls etc..
Is there a way to do with NOT using INDIRECT VLOOKUP, possibly with VBA?
If its not possible, would it be possible to prompt the user when they open the main workbook, to select the file to be used for VLOOKUP?
Excel Formula:
=IFNA(VLOOKUP(A20,'Z:\Folder\Info\Company\(Updated Data)\[2024data.xls]Sheet1'!$A$1:$W$1000,3,FALSE),"NF")
I export a report from our system for the current financial year, into this 2024data.xls file.
Then I open the main workbook, and have some VBA code that determines the current financial year, and then it opens that corresponding workbook, which allows the VLOOKUPs to update in the main workbook, then the VBA code closes the 2024data.xls workbook after the values have been updated.
What I want to do is have a dynamic VLOOKUP, or an alternative solution, I have tried the INDIRECT VLOOKUP but that requires the other workbook to be open the whole time. This will NOT work for me.
If the financial year is FY23/24 (I call it 2024 in my workbook, FY24/25 would be called 2025 etc.) Then I want the VLOOKUP to be looking in 2024data.xls, if the financial year is 2025, then VLOOKUP in 2025data.xls etc..
Is there a way to do with NOT using INDIRECT VLOOKUP, possibly with VBA?
If its not possible, would it be possible to prompt the user when they open the main workbook, to select the file to be used for VLOOKUP?