Excel VBA - Graph Update Loop -


having trouble below code i've written. should updating entries of graph ran dl5:hx5 dl5:iu5, have around 100 sheets hence loop. reason it's stepping through appear have semantic error. hoping might shed light was.

there 3 figures, , i'm not sure best way access figures on multiple sheets (they're identical copies of 1 another, different data.) first 2 extends time series additional columns (e.g. hx iu), last figure color formats line different color (the line split projected , actual line fragments.)

dim integer  = 31 activeworkbook.worksheets.count  on error resume next  worksheets(i).chartobjects("chart 2").activate activechart.seriescollection(1).values = "='" & worksheets(i).name & "'!$dl$5:$iu$5" activechart.seriescollection(1).xvalues = "='" & worksheets(i).name & "'!$dl$3:$iu$3"  worksheets(i).chartobjects("chart 6").activate activechart.seriescollection(1).values = "='" & worksheets(i).name & "'!$dl$14:$iu$14" activechart.seriescollection(2).values = "='" & worksheets(i).name & "'!$dl$15:$iu$15" activechart.seriescollection(3).values = "='" & worksheets(i).name & "'!$dl$16:$iu$16" activechart.seriescollection(3).xvalues = "='" & worksheets(i).name & "'!$dl$3:$iu$3"  worksheets(i).chartobjects("chart 1").activate activechart.seriescollection(1).points(30).border.color = rgb(69, 114, 167) activechart.seriescollection(1).points(30).format.line.forecolor.rgb = rgb(69, 114, 167)  next 

you should avoid activating/selecting can. untested:

sub tester()  dim integer dim sht worksheet      = 31 activeworkbook.worksheets.count         set sht = activeworkbook.sheets(i)          sht.chartobjects("chart 2").chart.seriescollection(1)             .values = sht.range("$dl$5:$iu$5")             .xvalues = sht.range("$dl$3:$iu$3")         end          sht.chartobjects("chart 6").chart             .seriescollection(1).values = sht.range("$dl$14:$iu$14")             .seriescollection(2).values = sht.range("$dl$15:$iu$15")             .seriescollection(3).values = sht.range("$dl$16:$iu$16")             .seriescollection(3).xvalues = sht.range("$dl$3:$iu$3")         end          sht.chartobjects("chart 1").chart.seriescollection(1).points(30)             .border.color = rgb(69, 114, 167)             .format.line.forecolor.rgb = rgb(69, 114, 167)         end      next  end sub 

edit: renaming charts

for = 31 activeworkbook.worksheets.count         activeworkbook.sheets(i)             on error resume next             .chartobjects("chart 13").name = "chart 2"             on error goto 0         end next 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -