|
I'm using Scott's spreadsheet utility from SystemiNetwork (thanks Scott!) and am having problems when trying to write to a second worksheet. I'm trying to replace a manual process where data is copied into several worksheets (one for each company), then the data is summarized for all companies on another worksheet. There can be different amounts of detail for each run, so a static formula pointing to ranges on the other worksheets can't be used for the summary worksheet (hm, named ranges might be a possibility). I have the detail along with subtotals for that worksheet working fine in the first worksheet. Next, I open a second worksheet and try to write a formula referencing the first worksheet. The formula is written to the first worksheet instead. I suspect I'm missing something simple here, such as needing to close the first worksheet first. Debug does show the second worksheet as being my "sheet". Here are some code snippets to show what I'm trying to do. // Set Begin point for cleanup, up to 100 objects.) hssf_begin_object_group(100); // Load a copy of the workbook. CurBook = BookIn; Book = hssf_open(%Trim(CurBook)); <small snip - style setup> // Open the spreadsheet within the workbook. <== first worksheet sheet = hssf_getSheet(book: 'Company One'); ExSr $CellDetail; <== this writes out detail records and summarizes transaction types // Open the spreadsheet within the workbook. <== second worksheet sheet = hssf_getSheet(book: 'Summary'); ExSr $CellSummary; <== this writes my summary formula to the first worksheet, not to the second worksheet I've tried saving the file to disk, then reloading it before opening the second worksheet, but the formula still appeared on my first worksheet. For this, I inserted the following after the ExSr $CellDetail; and before the sheet = hssf_getSheet(book: 'Summary'); CurBook = BookOut; hssf_save(Book: %Trim(CurBook)); CurBook = BookIn; // Book = hssf_open(%Trim(CurBook)); and the first worksheet still has the formula that should be on the second worksheet. When I remember to leave off the // on the last bit of code, the first worksheet does not have any data in it at all. Hopefully this is enough code to let you show me what silly thing I'm missing. Thanks. Mark Plank
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.