+ Reply to Thread
Results 1 to 6 of 6

Delete unused sheets?

  1. #1
    Valued Forum Contributor
    Join Date
    02-26-2010
    Location
    Chattanooga, TN
    MS-Off Ver
    Excel 2003/2007/2010/2016
    Posts
    432

    Question Delete unused sheets?

    Hello!

    Here is what I would like to do:

    When you are done using your workbook, select Save/Save As/ or respond Yes to that Do you want to Save Changes dialogue box.

    The program looks for every sheet that has DELETEME in all cells G1:G3 or H1:H3.

    Before it saves, it pops up a dialogue box asking "Do you want to save the entire workbook, or just the changed sheets? (Sheets Sheet1Name, Sheet2Name, Sheet3Name will be deleted.)"

    If you select Entire Workbook (or the macro has an error), save the entire workbook as normal (bring up the "How do you want to save?" dialogue). Otherwise, If you select Changed Sheets, delete all sheets with DELETEME in G1:G3 or H1:H3, and then bring up the "How do you want to save?" dialogue.

    (I have 6 workbooks with varying number of sheets. Instead of the users saving the entire workbook when only one sheet has been changed, I want only the changed sheets to be saved and the rest of the unused sheets deleted. Those cells G1:G3 are for Last Name, First Name, Middle Name. I pre-fill those with DELETEME. If the user hasn't used those sheets and changed the name data, DELETEME will still be there.)

    ??

    Thanks for the help!

    VR/Lost
    Last edited by leaning; 06-30-2010 at 09:00 AM. Reason: Solved!

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,485

    Re: Delete unused sheets?

    Try This
    Please Login or Register  to view this content.
    Just save the workbook, what is the difference if you only changed one worksheet or all of them?

  3. #3
    Valued Forum Contributor
    Join Date
    02-26-2010
    Location
    Chattanooga, TN
    MS-Off Ver
    Excel 2003/2007/2010/2016
    Posts
    432

    Re: Delete unused sheets?

    Dave,

    Thanks for your help!

    I used your stuff, mixed it with some other stuff I found, and now I have this. Please look this over if you get a chance to make sure it passes the sanity test.

    VR/Lost



    Please Login or Register  to view this content.

  4. #4
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,485

    Re: Delete unused sheets?

    If it works, then great!

  5. #5
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Delete unused sheets?

    or
    Please Login or Register  to view this content.

  6. #6
    Valued Forum Contributor
    Join Date
    02-26-2010
    Location
    Chattanooga, TN
    MS-Off Ver
    Excel 2003/2007/2010/2016
    Posts
    432

    Re: Delete unused sheets?

    SNB,

    Thanks! I knew my code was "wordy" so I was hoping someone would come along and see stuff that could be squashed. Outstanding!

    VR/Lost

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1