Hello,
Could you please help provide a vba code that can delete all the tabs before it hits the tab named "Input"? I want to keep all the tabs after this Input tabs but delete all the tabs before it.
Thanks,
Hello,
Could you please help provide a vba code that can delete all the tabs before it hits the tab named "Input"? I want to keep all the tabs after this Input tabs but delete all the tabs before it.
Thanks,
That would be a very dangerous thing to do ... as far as workbook content is concerned. If anyone changed the order of the worksheets, for whatever reason, you might end up deleting the wrong sheets.
I would recommend that you specify the sheets to keep, or delete, perhaps with a wild card.
Trevor Shuttleworth - Retired Excel/VBA Consultant
I dream of a better world where chickens can cross the road without having their motives questioned
'Being unapologetic means never having to say you're sorry' John Cooper Clarke
Thank you for your input. I already thought of that, therefore I ensured the tabs follow the order. However, I'm open for suggestion using the wild card as you mentioned.
Depends what the tabs are called and if there is any consistency in the naming. For example, Data1, Data2, Data3, ... Input, Output1, Output2, ... Outputx.
You could use Data* to identify the sheets to delete, or Input and Output* to identify the sheets to delete.
They have different name without consistency. Can we do as I requested to delete the tabs before the Input tabs?
You could try...
...but please test on a sample workbook as you won't be able to recover the delete.![]()
Please Login or Register to view this content.
HTH
Regards, Jeff
Try this code
![]()
Please Login or Register to view this content.
< ----- Please click the little star * next to add reputation if my post helps you
Visit Forum : From Here
I tried the latest code and it deleted all the sheets in the workbook.
It is better to upload sample of your workbook
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks