PDA

View Full Version : chart to be created in new sheet This macro creates chart in the worksheet same as da



asdzxc
04-26-2012, 07:23 PM
This macro creates chart in the worksheet same as data. Plse add code so that chart can be created in new worksheet.
Range("A4:C19").Select
ActiveSheet.Shapes.AddChart.Select ActiveChart.ChartType = xlLineMarkers ActiveChart.SetSourceData Source:=Range("'P11'!$A$4:$C$19") End Sub

Bob Phillips
04-26-2012, 11:48 PM
Add this


ActiveChart.Location xlLocationAsNewSheet

asdzxc
04-27-2012, 12:40 AM
your code added but: comile error;use of property at
xlLocationAsNewSheet
ActiveChart.Location
xlLocationAsNewSheet
ActiveSheet.Shapes.AddChart.Select
ActiveChart.ChartType = xlLineMarkers
ActiveChart.SetSourceData Source:=Range("'P11'!$A$4:$C$28")
End Sub

Bob Phillips
04-27-2012, 08:55 AM
You add it all in ONE line, AFTER your code. You cannot reference ActiveChart before there is one.

asdzxc
04-27-2012, 07:25 PM
ok
thank you