ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Automatically updating external data sources (https://www.excelbanter.com/excel-programming/387614-automatically-updating-external-data-sources.html)

[email protected]

Automatically updating external data sources
 
I would like to get some feedback on how to best go about a task my
boss is wanting to get help with:

My boss is wanting to have a spreadsheet that shows data from the
current month and previous two months. Sounds simple enough, but each
month's data is going to be stored in its own Excel spreadsheet.

Now, is there a way to create a chunk of code that would:

Automatically update to the current month data and previous 2 month's
data without having to hard code the external file source names upon
opening the workbook?

If so, what kind of naming structure for the external files do you
recommend to enable this process?

Here's something I am thinking of... am I on the right track?

upon opening of the workbook, there would be a statement to take the
system date.

A case statement to convert the system date format to recognize the
current month and previous two months... (i.e. System date returns a
value of "04-17-2007" so there would need to be code that parses this
date format to determine the month is April of 2007).

Statement assigns value of "04_2007" to variable CurrentMonth and then
goes through operation to assign "03_2007" and "02_2007" as previous
two months.

Statement that conjuncts variable names and filename extention (i.e.
"04_2007", ".xls") to create dynamic external reference.


Will this work? And if so, any code examples would be helpful.

Thanks!

Jason Portell
jportell @ wildblue . net



All times are GMT +1. The time now is 01:53 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com