This is driving me crazy and I cannot seem to figure it out. There is a button for the macro on each sheet in the workbook so that you can run it no matter what sheet you are on (so you can select the sheets you want to keep and always have access to the macro). The macro basically converts all formulas to values, determines how many pages are needed and adds a line at the bottom of the last page for that worksheet. It should then go through and delete the sheets that are not selected, and the sheets that are selected it should delete columns with information just used for formulas before it converted them to values. It then should remove the button that is on the selected sheets and then save the file and delete the macros/visual basic coding.
The issue is coming with removing the buttons from the sheets that are selected. The coding works on each sheet individually (including "Sheet1"), and will work on groups of sheets as long as "Sheet1" is not a selected sheet in the group. As soon as you select "Sheet1" with other sheets I get the error:
Run-time error '1004':
Application-defined or object-defined error
What could be causing this error since it works on "Sheet1" by itself, but then when part of a group it seems to be failing because of "Sheet1"?
I included all coding in case it was being caused by coding in another part, but the coding works just as it should if I just leave the buttons there, so willing to receive input on anything else you see "wrong", but would like the main problem solved.
The line it is stopping on is bold in the code.
Bookmarks