Ok I'm in the classic position of being asked to provide some quick-fixes for an Excel Hell not of my making. :^) Here's the situation:
VBA is being used to chop a dataset into several hundred pieces which are each inserted into a separate workbook (all with an identical layout, number of rows, etc). Manual changes may or may not be made to the data (not layout) of those individual workbooks, and then we want to roll them back up again to a new executive summary workbook.
Delicious, no?
So conceptually, the interim fix I'm considering is writing a custom "SpiderSum" function that would be used in the worksheet formulas of the executive summary workbook. This function would accept two arguments (both range references):
* "SourceWorkbooks" would be a range containing a list of complete filepaths in column 1, and worksheet names in column 2.
* "TargetRange" would be the range (could be more than one cell) containing the values that need to be summed.
So =SpiderSum(SourceWorkbooks,TargetRange) would loop through every workbook listed in SourceWorkbooks column 1, creating a running total of all the values in TargetRange on the sheet specified in SourceWorkbooks column 2.
Even with xlCalculation set to manual and ScreenUpdating off, this would definitely to take a while to run. The advantage is that it would give the users the ability to modify the Executive Summary layout and source workbooks without rewriting any VBA...
I think I can write the code for this but conceptually, what do you think? Anyone done something similar? Am I reinventing the wheel or creating a monster (keeping in mind that I'm aware that the true/best solution is to not fragment the data in the first place)?
Fire away! ;-)
VBAjedi
VBA is being used to chop a dataset into several hundred pieces which are each inserted into a separate workbook (all with an identical layout, number of rows, etc). Manual changes may or may not be made to the data (not layout) of those individual workbooks, and then we want to roll them back up again to a new executive summary workbook.
Delicious, no?
So conceptually, the interim fix I'm considering is writing a custom "SpiderSum" function that would be used in the worksheet formulas of the executive summary workbook. This function would accept two arguments (both range references):
* "SourceWorkbooks" would be a range containing a list of complete filepaths in column 1, and worksheet names in column 2.
* "TargetRange" would be the range (could be more than one cell) containing the values that need to be summed.
So =SpiderSum(SourceWorkbooks,TargetRange) would loop through every workbook listed in SourceWorkbooks column 1, creating a running total of all the values in TargetRange on the sheet specified in SourceWorkbooks column 2.
Even with xlCalculation set to manual and ScreenUpdating off, this would definitely to take a while to run. The advantage is that it would give the users the ability to modify the Executive Summary layout and source workbooks without rewriting any VBA...
I think I can write the code for this but conceptually, what do you think? Anyone done something similar? Am I reinventing the wheel or creating a monster (keeping in mind that I'm aware that the true/best solution is to not fragment the data in the first place)?
Fire away! ;-)
VBAjedi