Article ID: 186220
Article Last Modified on 10/10/2006
A1: 1
A2: 2
A3: 3
Sub AddChart()
Charts.Add
ActiveChart.ChartType = xlColumnClustered
ActiveChart.SetSourceData _
Source:=Sheets("Sheet1").Range("A1:A3"),PlotBy:=xlColumns
'At this point, the active sheet is a Chart sheet with a column chart
'and ActiveSheet.Name will return "Chart1" as a string value.
ActiveChart.Location _
where:=xlLocationAsObject, Name:=ActiveSheet.Name
End Sub
Sub AddChart()
mysheet=ActiveSheet.Name
Charts.Add
ActiveChart.ChartType = xlColumnClustered
ActiveChart.SetSourceData _
Source:=Sheets("Sheet1").Range("A1:A3"), PlotBy:=xlColumns
'At this point, the active sheet is a Chart sheet with a column chart
'and ActiveSheet.Name will return "Chart1" as a string value.
'Since the variable mysheet picks up the name of the activesheet
'before the chart sheet is created, you will not unexpectedly quit
'using the variable.
ActiveChart.Location _
where:=xlLocationAsObject, Name:=mysheet
End Sub176476 OFF: Office Assistant Not Answering Visual Basic Questions
Additional query words: XL98 freeze hang lock up
Keywords: kbbug kbdtacode kbpending kbprogramming KB186220