View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
Nick Hodge Nick Hodge is offline
external usenet poster
 
Posts: 1,173
Default Deleting multiple Chart Tabs/sheets

Just run some code to find the type and send it to the debug window

For each sh in thisworkbook.sheets
Debug.Print sh.type
Next sh

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
HIS


"CLR" wrote in message
...
Sorry about that Nick............I didn't see your post on my newsgroup
until AFTER I had already responded to Shawn's, and then came home from
work.......... yet here at home it shows as coming in BEFORE his.......if
any event, your's works great as well............I asked for 1-50 because
I
thought I wanted to adjust the range from time to time.........both of you
guy's macros delete ALL of the charts, which is fine-ok in this
case..........if I make 20 charts and delete them manually, the next chart
comes up #21, and if I go ahead then and make another 30 then I'm up to
Chart #50 but only have 30.........that's why I asked the question the way
I
did........thought I could take it out well beyond the range I might
use.......but deleting them all works too.......It's interesting to see
two
different versions of code to do the same thing..........BTW, "where" does
one find out that "sht. Type=3" is applicable in this case?

Thanks again,
Vaya con Dios,
Chuck, CABGx3




"Nick Hodge" wrote in message
...
Chuck

Your question is a little ambiguous as you say it creates 37charts but
you
want to delete 1 to 50. If it is ALL chart sheets you want to delete the
code below will do it

Sub DeleteChartSheets()
Dim sht As Object
Application.DisplayAlerts = False
For Each sht In ThisWorkbook.Sheets
If sht.Type = 3 Then sht.Delete
Next sht
Application.DisplayAlerts = True
End Sub

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
HIS


"CLR" wrote in message
...
Hi All......

I am working on a program that creates 37 different Charts. Each gets
created as it's own sheet/tab. I never know how many will be
created/deleted
during the course of a session. When the session is complete, I would
like a
macro to delete all Chart Tab/sheets, regardless of their "Chart 22" or
"Chart 12" numbers which Excel assigns them....I would like it to
delete
all
existing Chart/tab between numbers 1 and 50 inclusive, but NOT
non-chart
tabs/sheets. Recording the macro, just don't seem to get me
there.......any
help would be much appreciated.

TIA
Vaya con Dios,
Chuck, CABGx3