Consulting

Results 1 to 6 of 6

Thread: Delete Selected Sheet

  1. #1
    VBAX Regular
    Joined
    Apr 2008
    Location
    Manila
    Posts
    14

    Delete Selected Sheet

    Hi Experts,

    Thank you for all your help. I just want to ask if Excel has a functionality selecting what sheets to be deleted. I have a workbook that has 50++ sheets. I would like to create a function (probably a customized "Remove Sheet" button). Whenever this function is called. It will popup list of all the sheets which you can select individually (probably by ticking a checkbox) and then a delete confirmation button.

    You guys have been very helpful. Thank you in advance.

    Regards,

    Tony

  2. #2
    I put together a simple demo of how to do this (see attached). Basically you just create a user form with a listbox (with multi select enabled). When the form loads you add every worksheet name to the listbox. Then you select all the sheets you want to delete, and hit a button that runs through your listbox's items and sees which are selected, deleting each.

  3. #3
    VBAX Regular
    Joined
    Apr 2008
    Location
    Manila
    Posts
    14
    Hi jfournier,

    Thank you very much. I was able to work on the user form and I was able to generate the list when I ran the codes. However, I would like to run it from a command button (ex: Remove Sheet). Once I clicked on this button, the user form will popup giving me an option to delete. How can I work around this.

    As I see from your attachment that I need to go to Visual Basic and run the scripts from there, then the user form will popup. How can I link the script from a command button ("Remove Sheet")

    Regards,

    Tony

  4. #4
    your script just needs to say "frmDeleteSheets.Show 0"

    replace frmDeleteSheets with whatever I named the form. I don't remember at the moment.

  5. #5
    VBAX Tutor
    Joined
    Feb 2006
    Posts
    295
    Location
    check this out from Tstav:
    http://vbaexpress.com/kb/getarticle.php?kb_id=998


    zach

  6. #6
    VBAX Regular
    Joined
    Apr 2008
    Location
    Manila
    Posts
    14
    Thanks a lot!!!

Posting Permissions

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