I've searched through many of the other threads about VBA for retrieving data from closed workbooks but all of them refer to a static address in the VBA itself (ex. C:\folder\folder\filename.xlsx).
In my case I need to run a macro which will update all of the formulas that I have, since they will not pull data from the file I am telling them to unless that file is currently open.
What happens is: our systems automatically generate a new file everyday in the same folder, with a filename of the date that is generated (ex. 01-01-2017), and the data that we want to pull automatically is usually in cell B11 of that, however that may change, so thats the reason we have Row B which would allow us to specify where we want our formula to look.
The problem is: excel wont use this indirect formula to look at the new file since that file is not currently open.
The solution is: a macro button which will force excel to peek in the file and display the data. I just don't know how that will work. So please help me.
The user would will open this file every couple days, drag down the formulas to correspond with the days that have passed, then click the macro button and wait for the data to upload.
Here's the structure:
[TABLE="width: 600"]
<tbody>[TR]
[TD]DATE(rowA)[/TD]
[TD]CELL(RowB)[/TD]
[TD]FORMULA (Row C)[/TD]
[/TR]
[TR]
[TD]01-01-2017[/TD]
[TD]B11[/TD]
[TD]=indirect(" 'C:\folder\[ "&A2&".xlsx]Sheet1'! "&B2)[/TD]
[/TR]
[TR]
[TD]01-02-2017[/TD]
[TD]B11[/TD]
[TD]=indirect(" 'C:\folder\[ "&A3&".xlsx]Sheet1'! "&B3)[/TD]
[/TR]
[TR]
[TD]01-03-2017[/TD]
[TD]B11[/TD]
[TD]=indirect(" 'C:\folder\[ "&A4&".xlsx]Sheet1'! "&B4)[/TD]
[/TR]
</tbody>[/TABLE]
The DATE is the file name that I need the macro to re-open (/open if its the first time).
Your thoughts would be GREATLY appreciated.
Thank you
In my case I need to run a macro which will update all of the formulas that I have, since they will not pull data from the file I am telling them to unless that file is currently open.
What happens is: our systems automatically generate a new file everyday in the same folder, with a filename of the date that is generated (ex. 01-01-2017), and the data that we want to pull automatically is usually in cell B11 of that, however that may change, so thats the reason we have Row B which would allow us to specify where we want our formula to look.
The problem is: excel wont use this indirect formula to look at the new file since that file is not currently open.
The solution is: a macro button which will force excel to peek in the file and display the data. I just don't know how that will work. So please help me.
The user would will open this file every couple days, drag down the formulas to correspond with the days that have passed, then click the macro button and wait for the data to upload.
Here's the structure:
[TABLE="width: 600"]
<tbody>[TR]
[TD]DATE(rowA)[/TD]
[TD]CELL(RowB)[/TD]
[TD]FORMULA (Row C)[/TD]
[/TR]
[TR]
[TD]01-01-2017[/TD]
[TD]B11[/TD]
[TD]=indirect(" 'C:\folder\[ "&A2&".xlsx]Sheet1'! "&B2)[/TD]
[/TR]
[TR]
[TD]01-02-2017[/TD]
[TD]B11[/TD]
[TD]=indirect(" 'C:\folder\[ "&A3&".xlsx]Sheet1'! "&B3)[/TD]
[/TR]
[TR]
[TD]01-03-2017[/TD]
[TD]B11[/TD]
[TD]=indirect(" 'C:\folder\[ "&A4&".xlsx]Sheet1'! "&B4)[/TD]
[/TR]
</tbody>[/TABLE]
The DATE is the file name that I need the macro to re-open (/open if its the first time).
Your thoughts would be GREATLY appreciated.
Thank you