raven_squire
Board Regular
- Joined
- Jan 13, 2013
- Messages
- 99
Hello In the following code I am trying to see if a worksheet exists and if not I want to create a graph as a worksheet (I am not sure what the propper term for this is). However the test does not test the worksheet that contains the graph only the regular worksheets. Any help to determin if the graph workshees already exists would be apreciated.
Thanks Steve
Thanks Steve
Code:
'See if the chart sheet exists
Debug.Print "******"
For Each Sheet In Worksheets
Debug.Print Sheet.Name
If Sheet.Name = line & "_" & Direction & "_" & Class Then
MsgBox "The graph that you are trying to generate already exists." & Chr(13) & "Please delete the graph and try again.) "
Debug.Print "True"
End
Else
Debug.Print "fail"
End If
Next Sheet
Charts.Add Before:=Worksheets(Worksheets.Count)
With ActiveChart
'Chart Specifics
.ChartType = xlXYScatter
.Location Where:=xlLocationAsNewSheet, Name:=line & "_" & Direction & "_" & Class
.HasTitle = True
.ChartTitle.Characters.Text = ChartXtitle
Last edited by a moderator: