pedie
Well-known Member
- Joined
- Apr 28, 2010
- Messages
- 3,875
Hi, currently 'm using the code below, however i do not want to use error to check if chart exists in the sheet.
Please suggest better code. I just want to check if chart exist in active sheet irrespective of any name...
thanks in advance
Please suggest better code. I just want to check if chart exist in active sheet irrespective of any name...
thanks in advance
Code:
[FONT=Courier New][FONT=Courier New]Option Explicit
Public chartexist As Boolean
[/FONT][/FONT]Sub CheckIfChartExist()
On Error GoTo Err1
ActiveSheet.ChartObjects(1).Activate
chartexist = True
Range("A1").Select
Exit Sub
Err1:
chartexist = False
Err.Clear
End Sub
Sub TestFunction()
CheckIfChartExist
If chartexist = False Then
MsgBox "False"
Else
MsgBox "True"
End If
End Sub
Last edited: