allison
11-20-2008, 12:52 PM
I know what my problem is, but not sure how to fix it.
I have 100 rows of data - each row needs to be it's own chart. I keystroked the macro to make the chart, but I need to make the chart number a variable so that it will work for all the rows.
This is what I have:
ActiveCell.Range("A1:J2").Select
ActiveSheet.Shapes.AddChart.Select
ActiveChart.SetSourceData Source:=Range("Sheet2!$A$1:$J$2")
ActiveChart.ChartType = xlLine
ActiveChart.Legend.Select
Selection.Delete
ActiveSheet.ChartObjects("Chart 6").Activate
ActiveChart.SeriesCollection(1).Select
ActiveSheet.ChartObjects("Chart 6").Activate
ActiveChart.SeriesCollection(1).ApplyDataLabels
ActiveSheet.ChartObjects("Chart 6").Activate
ActiveChart.SeriesCollection(1).Trendlines.Add
ActiveSheet.ChartObjects("Chart 6").Activate
ActiveChart.SeriesCollection(1).Trendlines(1).Select
ActiveWindow.SmallScroll ToRight:=2
ExecuteExcel4Macro "PRINT(1,,,1,,,,,,,,2,,,TRUE,,FALSE)"
ActiveSheet.ChartObjects("Chart 6").Activate
ActiveChart.PlotArea.Select
Selection.ClearFormats
ActiveSheet.ChartObjects("Chart 6").Activate
ActiveChart.ChartArea.Select
ActiveChart.Parent.Delete
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 1
ActiveCell.Offset(1, 0).Rows("1:1").EntireRow.Select
Selection.Delete Shift:=xlUp
End Sub
How is the best way to do this? Any suggestions?
I have 100 rows of data - each row needs to be it's own chart. I keystroked the macro to make the chart, but I need to make the chart number a variable so that it will work for all the rows.
This is what I have:
ActiveCell.Range("A1:J2").Select
ActiveSheet.Shapes.AddChart.Select
ActiveChart.SetSourceData Source:=Range("Sheet2!$A$1:$J$2")
ActiveChart.ChartType = xlLine
ActiveChart.Legend.Select
Selection.Delete
ActiveSheet.ChartObjects("Chart 6").Activate
ActiveChart.SeriesCollection(1).Select
ActiveSheet.ChartObjects("Chart 6").Activate
ActiveChart.SeriesCollection(1).ApplyDataLabels
ActiveSheet.ChartObjects("Chart 6").Activate
ActiveChart.SeriesCollection(1).Trendlines.Add
ActiveSheet.ChartObjects("Chart 6").Activate
ActiveChart.SeriesCollection(1).Trendlines(1).Select
ActiveWindow.SmallScroll ToRight:=2
ExecuteExcel4Macro "PRINT(1,,,1,,,,,,,,2,,,TRUE,,FALSE)"
ActiveSheet.ChartObjects("Chart 6").Activate
ActiveChart.PlotArea.Select
Selection.ClearFormats
ActiveSheet.ChartObjects("Chart 6").Activate
ActiveChart.ChartArea.Select
ActiveChart.Parent.Delete
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 1
ActiveCell.Offset(1, 0).Rows("1:1").EntireRow.Select
Selection.Delete Shift:=xlUp
End Sub
How is the best way to do this? Any suggestions?