Macro to delete Hidden Worksheets?

jkharmer

Board Regular
Joined
Jul 7, 2008
Messages
77
Any ideas? It would be great of I could delete all but one of the hidden worksheets. It would be perfect if I could tell the macro not to delete one of the hidden worksheets (called "Test O2 and CO2"), but if that is too difficult, then just one to delete all the hidden sheets would be fine.

Any help would be much appreciated on this one,

James
 
James

Why do you want delete hidden sheets in the first place?
 
Upvote 0

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
ARGHHH

Still deleting those worksheet.

I have set up a very simple 6 sheet workbook, named 1 of the sheets Test O2 and the other Test CO2, hidden them and 3 of the blank sheets, run the macro and the 3 blank sheets get ddeleted, leaving the Test CO2 and O2 there and still hidden.

I do the same for my document, and it just deletes all hidden worksheets, including the ones I have asked it not to delete!

Norrie, I am deleting sheets as my workbook is 30Mb in size - it is a Master Template which covers every single job we may need to do. However some jobs a re very simple, and although the Master Template has something like 35 sheets, I may only require 6 of them for this simple job. If I then delete the the worksheets that are not required (i.e. ones that I have used a "Yes / No" box to hide) I can reduce the file size down to around 4Mb.

James
 
Upvote 0
I would check the exact spelling of the two hidden sheets that you want to keep. Check for leading/trailing spaces and so on.
 
Upvote 0
James

I would suggest you take a different approach.

I've no idea what data you are dealing with though since you've not posted any but do really need this 'Master' template?:)
 
Upvote 0
YES - thanks VOG.

The actual tab names were TEST O2 and TEST CO2. I did not click that it may be case sensitive!

Thanks for you help!

Norrie, seeing as I am about 1500 hours into building my Master Template, I think I have put all my eggs in one basket!!:LOL:

It is a pretty complex thing which pulls info from all the tabs into a "report" which gets sent to our customer/s.

I am sure there may have been better ways to do things, but I am where I am and I think it should be OK in its current state.

Thanks anyways, James
 
Upvote 0

Forum statistics

Threads
1,215,059
Messages
6,122,913
Members
449,093
Latest member
dbomb1414

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