Macro to copy selected sheets based on filtered cell values to new workbook

  • Hi everyone, hope you're all safe and well!

    I'm writing a code that once you click on one button, it:

    1. Filters values in a table based on a combobox value (the first column of these filtered value is the name of my sheets)
    2. Creates a new blank workbook named from the combobox & another cell in my workbook
    3. Select all the sheets whose names are presents in the filtered value ("C" Column)
    4. Copy Paste the selected sheets in the workbook created in 2
    5. Saves and closes workbook 2
    6. back to workbook 1 and removes filters

    I can't seem to make 3) and 4) working, I either copy all sheets (regardless of the filter), either (current code) copies only the last one.

    Please see the code below, thanks in advance! :)

  • There are a number of ways to do this.

    Going mostly with the code you have, I have the suggested changes below to the Filter/Extract section.

    This requires new variables for wsSht, rRange and rCell.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!