draw 43 xy scatter drawing using vba in excel -
i need draw 43 x/y scatter drawing using vba in excel developed code 1 drawing , not sure how can apply draw remaining 42 drawing mean don't want change range of data manually need put in loop or this. code
sub draw() activesheet.shapes.addchart2(240, xlxyscattersmoothnomarkers).select activechart.seriescollection.newseries activechart.fullseriescollection(1).name = "=""hbes""" activechart.fullseriescollection(1).xvalues = "=en!$g$253:$g$278" activechart.fullseriescollection(1).values = "=en!$h$253:$h$278" activechart.seriescollection.newseries activechart.fullseriescollection(2).name = "=""nhbes""" activechart.fullseriescollection(2).xvalues = "=en!$g$253:$g$278" activechart.fullseriescollection(2).values = "='en1'!$g$253:$g$278" activechart.seriescollection.newseries activechart.fullseriescollection(3).name = "=""nhbcs""" activechart.fullseriescollection(3).xvalues = "=en!$g$253:$g$278" activechart.fullseriescollection(3).values = "=en1c!$g$253:$g$278" activechart.seriescollection.newseries activechart.fullseriescollection(4).name = "=""hbcs""" activechart.fullseriescollection(4).xvalues = "=en!$g$253:$g$278" activechart.fullseriescollection(4).values = "=enc!$h$253:$h$278" activechart 'chart name .hastitle = true .charttitle.characters.text = "expected number of blockages pipes group 2 in condition state one" 'x axis name .axes(xlcategory, xlprimary).hastitle = true .axes(xlcategory, xlprimary).axistitle.characters.text = "time (years)" 'y-axis name .axes(xlvalue, xlprimary).hastitle = true .axes(xlvalue, xlprimary).axistitle.characters.text = "expected number of blockages" end end sub
please note data arranged in column next drawing should change line
activechart.fullseriescollection(1).values = "=en!$h$253:$h$278"
to
activechart.fullseriescollection(1).values = "=en!$i$253:$i$278"
and same remaining 3 series , x range constant drawing is
activechart.fullseriescollection(3).xvalues = "=en!$g$253:$g$278"
i hope clear
thanks in advance
Comments
Post a Comment