excel - How to assign a range to SeriesCollection.Value in VBA? -


i'm new programming excel macros, bear me , don't expect code efficient. have chart in want assign different ranges different seriescollections. have dataset in sheet "c". x-values(xvalues) same every graph, y-values(values) in different columns. since don't want assign every graph 1 @ time, thought of code:

sub mycode()     dim mychart chartobject, irow integer   dim rng range   set mychart = activesheet.chartobjects(1)     mychart.chart       irow = 1 15           set rng = sheets("c").range(sheets("c").cells(26, irow + 2), sheets("c").cells(51, irow + 2))           .seriescollection(irow).values = range(rng)           .seriescollection(irow).xvalues = "'c'!$a$26:$a$51"        next irow   end   end sub 

the problem in

.seriescollection(irow).values = range(rng) 

i having error 1004 "application-defined or object-defined error".

i tried different approaches including not limited to

.seriescollection(irow).values = "=""" & sheets("c").range(rng) & """" .seriescollection(irow).values = sheets("c").range(rng) .seriescollection(irow).values = range(rng).value 

and running out of ideas , couldn't find fitting solution in webs.

thanks in advance mwo

edit: have created chart in worksheet. there 15 different seriescollection values assigned them, assigned 1 @ time. @shairado pointing out missed inform that.


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -