Edited
Demo.ods
The attachemnt is a stripped down version of a spreadsheet for recording expenses. Periodically I archive the data by duplicating the ‘TripRecords’ via the ‘Save Data’ button on the sheet. The associated macro copies ‘TripRecords’ to ‘Newsheet’ (simplified here) and ‘freezes’ the data by getDataArray/setDataArray. This is all working.
Can I now delete the button on the copied sheet to avoid the data being corrupted?
Thanks to Pierre-Yves Samyn, the job is mostly done. RemoveByIndex() & Dispose() dissociate the macro from the button and the control from the shape (although I’m not sure I fully understand my own code), but the shape is still there. The data is now ‘safe’, but it would be tidy to delete the button from the sheet, which should be quite simple …