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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to determine if an object exists

Status
Not open for further replies.

akn846

Technical User
Oct 16, 2001
51
GB
On my spreadsheet, I have included an embedded chart - this object is the one to be used throughout the application, changes to data will be reflected by resetting the source data range on this object.

But I need to check that the object exists on the sheet - otherwise I'll have to recreate it. Could someone please suggest how I can check whether a chart exists on a worksheet programatically.

Many thanks

Andy
 
Consider this:

Sub IfChartExistsOnSheet()
Dim a As String
Dim endo As String
On Error GoTo endo
a = Worksheets("Sheet1").ChartObjects(1).Name
endo:
If a = "" Then nochart = 1
End Sub Thank you,
Dave Rattigan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top