error handling - check chart existance

A

annette2002

I've a chart sheet namely "chart1" and I want to check if this char
exists in the file before calling other functions. without checkin
this in the working file and that the chart does not exist.
is there a question to catch this?:rolleyes
 
W

William

Hi annette

Sub test()
Dim ch As Chart
For Each ch In ThisWorkbook.Charts
If ch.Name = "Chart1" Then
MsgBox "Chart exists"
Exit For
End If
Next ch
End Sub

--
XL2002
Regards

William

[email protected]

| I've a chart sheet namely "chart1" and I want to check if this chart
| exists in the file before calling other functions. without checking
| this in the working file and that the chart does not exist.
| is there a question to catch this?:rolleyes:
|
|
| ---
|
|
 
Top