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


New Member
Sep 1, 2011
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!

Forum statistics

Latest member

Some videos you may like

This Week's Hot Topics

  • VBA (Userform)
    Hi All, I just would like to know why my code isn't working. Here is my VBA code: [CODE=vba]Private Sub OKButton_Click() Dim i As Integer...
  • List box that changes fill color
    Hello, I have gone through so many pages trying to figure this out. I have a 2020 calendar that depending on the day needs to have a certain...
  • Remove duplicates and retain one. Cross-linked cases
    Hi all I ran out of google keywords to use and still couldn't find a reference how to achieve the results of a single count. It would be great if...
  • VBA Copy and Paste With Duplicates
    Hello All, I'm in need of some input. My VBA skills are sub-par at best. I've assembled this code from basic research and it works but is...
  • Macro
    is it possible for a macro to run if the active cell value is different to the value above it
  • IF DATE and TIME
    I currently use this to check if date has passed but i also need to set a time on it too. Is it possible? [CODE=vba]=IF(B:B>TODAY(),"Not...