View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
DaBeef DaBeef is offline
external usenet poster
 
Posts: 3
Default Quite a complicated problem

Hopefully someone can help me with this.

I've written a program in C++ which reads spreadsheets in csv / tab delim /
slk format and performs reporting tasks on them as specifed through report
maps. It has become quite a powerful tool, but I'm missing some functionality
which my manager would like included. For the most recent map, I've had to
process a list of over 200 suppliers and generate sales and purchase
summaries, leaving me with about 5 spreadsheet files for each. My manager
would like to have these reports run on a monthly basis, the sheets combined
into one workbook for each supplier and have graphs on each sheet. I know
this can be automated, but I have practically no knowledge of vba and haven't
got a wide enough time scale to learn it.

The problem could be solved as follows (see further down if the next two
paragraphs seem over complicated):
Keep a folder with a separate xls file for each supplier, already filled in
with tables and graphs. This would mean that the script could just replace
the values in the tables, and the graphs would be automatically updated. This
would be perfect for all but one sheet. The final sheet would need to be
replaced in it's entirety by another sheet.

I need a way of automating this process so it can be run on a list of
suppliers (which would match the file names of the files to be editted). It
would need to increment through each value in the list, read the newly
created file of that name (perhaps appended with a phrase like " Sales
Summary", then overwrite the relevant cells in the master workbook's
worksheets and replace the last full page.

For clarity, my program could generate the following output (named as xls
files but actually slk):

3M Purchases and Sales Summary.xls
3M Purchases by Trade Term.xls
3M Sales Summary.xls
3M Sales by Branch.xls
3M Top 50 Sales Products.xls

The master file could be called 3M.xls with the following worksheets:

Purchases and Sales Summary
Purchases by Trade Term
Sales Summary
Sales by Branch
Top 50 Sales Products

Four of the sheets would need to have specific cells replaced from the
relevant new files. These would be done through direct cell references which
I will happily define in the script, so I imagine this would be fairly easy.
For example, the script might say to take cell B3 from the source sheet and
overwrite cell A3 in the master sheet. I could then simply duplicate this for
all the cells that need to be replaced. The other sheet (Purchases by Trade
Term) needs to be replaced by the worksheet contained in 3M Purchases by
Trade Term.

I would need the script to be able to either cycle through a list of file
names, or perhaps through all the files in the master file folder and repeat
this task for each, updating "3M" with each new supplier name on each pass.

I know this is way beyond the scope of help and advice on a forum, but there
seem to be several vba geniuses around here, so I'm hoping someone can help.
If you can help me with any part of this problem, it would be much
appreciated.

Thanks!