Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Looping through chart worksheets


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

--
stuartmars
-----------------------------------------------------------------------
stuartmarsh's Profile: http://www.excelforum.com/member.php...fo&userid=2214
View this thread: http://www.excelforum.com/showthread.php?threadid=57134

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Looping through chart worksheets

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
....


stuartmarsh wrote:

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 with
through the chart wizard.
I have stepped through the code and can see that it skips the worksheet
with a chart.
Are chart worksheets different in some way to normal worksheets?
Please help!

--
stuartmarsh
------------------------------------------------------------------------
stuartmarsh's Profile: http://www.excelforum.com/member.php...o&userid=22142
View this thread: http://www.excelforum.com/showthread...hreadid=571344


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Looping through chart worksheets


Thanks that sorted it.


--
stuartmarsh
------------------------------------------------------------------------
stuartmarsh's Profile: http://www.excelforum.com/member.php...o&userid=22142
View this thread: http://www.excelforum.com/showthread...hreadid=571344

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Looping through Worksheets Steve Excel Programming 7 July 12th 05 07:56 PM
Looping worksheets in workbook Wylie C Excel Programming 2 March 18th 05 08:04 PM
Looping through Worksheets Kirk P. Excel Programming 1 February 7th 05 05:14 PM
looping through worksheets Alex ekster Excel Programming 1 July 21st 03 03:16 AM
looping through worksheets alex Excel Programming 0 July 20th 03 06:43 PM


All times are GMT +1. The time now is 12:03 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"