ben_sorensen
New Member
- Joined
- Jun 11, 2015
- Messages
- 44
The code that I have written works that all the workbooks are open (there are three) two of the files are forecasted demand and then there is a master that imports the data and digests it for managers. Everyday their are going to be new forecasts that need to be loaded.
I have written code to remove the variation of having people copy and paste data into the model and instead have written a macro that looks at the other file and pastes the values in the other sheet, because these files are going to change every day the file name changes by date everyday so what I am looking to do is write an equation that in order for the code to get the file name of the workbook it needs it references a cell in the master file, which is where the code will be activated.
Here is the part of code that I have written that keeps giving me an error:
Workbooks(ActiveSheet.Range("C12").Value).Sheets("Forecast Plan").Range("A1:DZ250").Copy
Does anybody have an idea of why I keep getting the subscript out of range error on this?
When I type in the name, as opposed to referencing the cell, it works just fine.
Any help would be appreciated!
Best
I have written code to remove the variation of having people copy and paste data into the model and instead have written a macro that looks at the other file and pastes the values in the other sheet, because these files are going to change every day the file name changes by date everyday so what I am looking to do is write an equation that in order for the code to get the file name of the workbook it needs it references a cell in the master file, which is where the code will be activated.
Here is the part of code that I have written that keeps giving me an error:
Workbooks(ActiveSheet.Range("C12").Value).Sheets("Forecast Plan").Range("A1:DZ250").Copy
Does anybody have an idea of why I keep getting the subscript out of range error on this?
When I type in the name, as opposed to referencing the cell, it works just fine.
Any help would be appreciated!
Best