How to automatically change path name for reference to most recent closed workbook

Retroshift

Board Regular
Joined
Sep 20, 2016
Messages
119
Office Version
  1. 2019
Platform
  1. Windows
Hi,

I have two workbooks: one is closed and one is open. And I would like to extract data from the closed one into the open one.

I can return the value of cell A2 of the closed external workbook in my open workbook with the following formula: =INDEX('C:\path\[externalworkbook.xlsx]Sheet1'!A:A;2)

However, every day a new workbook with a different name (workbook name = date+time of export; e.g. MyRequests-20220518_160450) is generated into the file folder in order to represent the latest data. I want to use the most recent external workbook and I am able to identify it in my open workbook.

My question is how can I reference the identified most recent workbook name in the INDEX path? Are there VBA or non-VBA solutions besides the INDIRECT function? (I noticed that the INDIRECT function does not allow to get data from a closed workbook.)

Thanks
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.

Forum statistics

Threads
1,217,311
Messages
6,135,788
Members
449,964
Latest member
BumKneesOhYeah

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top