ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Name a chart and copy it to another sheet (https://www.excelbanter.com/excel-programming/368912-name-chart-copy-another-sheet.html)

lif[_11_]

Name a chart and copy it to another sheet
 

Hi,
I'm new to excel macros - this is my first one that isn't just a bunc
of pieced together recordings.. (instead it's a bunch of piece
together bits from the web!) Anyway, I'm creating a chart and placin
it in a summary sheet - I then need to be able to refer to it by nam
and make a copy of it to a specific range in another worksheet (ideall
I would be able to size it by placing the left at a particular range an
the right at another range etc.. so that it fits perfectly between som
cells.)

Here is the part that creates the chart - I'm stumbling with a way t
name it - there are different ways to do it depending on how the char
was created - but I don't understand the object model enough to figur
it out.

After I name it how can I make a copy and paste to another sheet

Any ideas???


Dim myChtObj As ChartObject

Set myChtObj = ActiveSheet.ChartObjects.Add _
(Left:=Range("m" & I + 10).Left + 5
Width:=Range("m" & I + 10).Width - 10, Top:=Range("m" & I + 10).Top
8, Height:=Range("m" & I + 10).Height - 10)

With myChtObj.Chart
.ChartType = xlXYScatter

Set srsNew
myChtObj.Chart.SeriesCollection.NewSeries

With srsNew
.name = "EtchRate A/(min)"
.Values
Sheets(ERsheetname(I)).Range("L14:L" & totalpostrows(I) + 13)
.XValues
Sheets(ERsheetname(I)).Range("E14:E" & totalpostrows(I) + 13)
End With

.Legend.delete
.ChartTitle.delete
.PlotArea.ClearFormats


Thanks so much,
Lui

--
li
-----------------------------------------------------------------------
lif's Profile: http://www.excelforum.com/member.php...fo&userid=3574
View this thread: http://www.excelforum.com/showthread.php?threadid=56682



All times are GMT +1. The time now is 06:15 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com