VBA Excel 2010 - Paste graph into excel while keeping source formatting -


im trying paste graph same excel spreadsheet have keeps source formatting.

i tried recording macro doesnt display code when paste, after googling found can paste powerpoint (found here) executemso can explained in link msdn.

the reason need paste charts excel while keeping souce formatting need make multiple charts information them, such legend etc etc

edit:

code have tried far , comes 1 error or another

sheets("sheet1").chartobjects(1).copypicture sheets("sheet1").paste destination:=worksheets("sheet1").range("i18")  activesheet.chartobjects(1).activate activechart.chartarea.copy 'application.commandbars.executemso "pasteexcelchartsourceformatting"  'activesheet.pastespecial format:="keep chart source formatting" link:=false _ displayasicon:=false 'activesheet.pastespecial format:="pasteexcelchartsourceformatting" link:=false _ displayasicon:=false 

keeping source formatting still keep link cell contents enabled charts can not hold values, grab. being, way keep thew chart reference either create new chart new set of data, may seem waste if want different data sets same custom formatting, can speed creating template original chart , create off of template each new set of data, can automate after data set this:

sub macro1() ' ' macro1 macro '  '  activesheet.shapes.addchart2(201, xlcolumnclustered).select activechart.applycharttemplate ( _         "c:\users\username\appdata\roaming\microsoft\templates\charts\whatyounamedthetemplate.crtx")sheet1!$a$1:$c$4 activechart.setsourcedata source:=range("sheetwheredatais!rangeyouwantcharttobecreatedfrom ex:sheet1!$a$1:$c$4") end sub 

pasting image may easiest way present charts though every time data set. if constant task on sheet might want create button next linked macro.

or alternatively if create macro clones entire sheet , copies chart on there original sheet while hiding clone data stored elsewhere , still have data tie to.

sorry workarounds task. let me know if think of other ways approach this.


Comments

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -