Try this.
"str_spreadsheet_name" holds the name of a file that has already been exported and Excel is open and running.
"obj_xls" then picks up the open spreadsheet.
It then creates pivot table called "Holdings" in the Excel sheet at AQ1, with rows being "rec_id", columns being "fund_name" and pivot field being "sum of fund_value".
It then copies the pivot table and does a patsespecial - values only. This removes all of the pivot table formatting.
It then tidies up the headings etc. If you run the process in debug you'll be able to see it working line by line.
Hope this is of use.
KD
Private Function reformat_fund_totals() |