Delete button on spreadsheet from a macro (solved) [closed]
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 ...
Would you mind to attach an example document demonstrating your issue?
"Macros are bad" is a not too excentric position among spreadsheet users. If you do not need the maxros at all, you can delete them from the containing module.
Archiving data in the full sense, however, may require to detach them from formulae. This is not a corruption but a change of purpose. Doing this the archive must not overwrite the functional spreadsheet, of course.
I'll act on this as soon as I have time. Sorry for delay. How do I make an attachment to my comment?
Sorry! No attachments to comments. To attach a file you have to edit your question (or an answer).