Automatic deletion of specific worksheets in a workbook using a VBA macro

robexcelguy

New Member
Joined
Sep 1, 2011
Messages
3
Hi All,

I am putting together an excel file which is to be used to create customised documents.

It works by using a front sheet where a user can input data. This data then customises the rest of the worksheets (eg client name, how they go about certain tasks etc).

As part of this process there is a checklist of the available documents (each document is a separate work sheet). This is to allow us to select the documents (and hence worksheets) that we need to be printed at the end.

So far we are able to create the documents from the inputted data using the IF function and some other basic formulas. We have not so far been able to work out how to trigger the deletion of a worksheet that contains a document they do not require.

One method we think might work is that if we have a list of the documents at the start and if the person selects that they do not want that document (i.e. select the "no" option) from a drop down list then a cell in that document will change to something like "delete-worksheet". Then by running a macro at the end, we can delete all worksheets containing that text in that particular cell.

Please let us know if we are on the right track. If we are please suggest a template VBA macro code which we could use.

If we are going about this wrong then please advise :)

Thanks for all your help!
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

Forum statistics

Threads
1,215,028
Messages
6,122,749
Members
449,094
Latest member
dsharae57

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top