Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Identifying chart object sheets in Excel VBA 1

Status
Not open for further replies.

Duffymk

Programmer
Sep 28, 2001
6
GB
Hello -

I am trying to write some code which moves through sheets and colours certain cells on each sheet. However, if the workbook contains a sheet which is only a graph, an error occurs. I would like a way to identify a sheet as being a chart object, so that then I can skip over it. Is there a way to do this?

Essentially I want to say:

If sheet is chart then
move to next sheet
else
run the code

Thanks!
Molly
 
Hi Molly,

Use the Worksheets collection, which doesn't contain the Chart sheets in the first place.

Instead of using
Code:
[purple]For Each objSheet In ActiveWorkbook.Sheets[/purple]
try, instead,
Code:
[blue]For Each objSheet In ActiveWorkbook.Worksheets[/blue]

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
Excel VBA Training and more Help at [url=http://www.vbaexpress.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top