Looping through chart worksheets

  • Thread starter Thread starter stuartmarsh
  • Start date Start date
S

stuartmarsh

I am trying to use a loop to delete any worksheet that ends in 'Chart
using the following code:

Dim ws As Worksheet
For Each ws In Worksheets
If Right(ws.Name, 5) = "Chart" Then ws.Delete
Next

However, this code does not appear to pick up worksheets created wit
through the chart wizard.
I have stepped through the code and can see that it skips the workshee
with a chart.
Are chart worksheets different in some way to normal worksheets?
Please help
 
There are different types of sheets that can be in a workbook.

Worksheets
Chart Sheets
Macro Sheets
International Macro Sheets
Dialog sheets

If you want to loop through all the sheets:

dim ws as object
for each ws in Sheets
....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top