

- #EXCEL TRENDLINE SCATTER PLOT MULTIPLE DATA HOW TO#
- #EXCEL TRENDLINE SCATTER PLOT MULTIPLE DATA CODE#
- #EXCEL TRENDLINE SCATTER PLOT MULTIPLE DATA SERIES#
This chart is primarily used in co-relation studies and regression studies of data. In this chart, we have two sets of data on the X and Y axis co-related.

ColorIndex = 1 '1=black 3=red 4= green 5= dark blue 7=magenta LineStyle = xlDot 'xlDash xlDashdot xlContinuous xlDot With ActiveChart.SeriesCollection(1).Border

Set sc = SeriesCollection.NewSeries This is the part that is not workingĪctiveChart.sc(2) Source:=Range("'" & sSheetName & "'!D1:D" & sRow &ĪctiveChart.Axes(xlValue).ScaleType = xlLogarithmicĪctiveChart.Axes(xlValue).CrossesAt = snXaxisCrossingĪctiveChart.Axes(xlValue).HasMinorGridlines = TrueĪctiveChart.Axes(xlValue).MinorGridlines.SelectĪctiveChart.Axes(xlCategory).ScaleType = xlLogarithmicĪctiveChart.Axes(xlCategory).CrossesAt = snYaxisCrossingĪctiveChart.Axes(xlCategory).HasMinorGridlines = True 'ActiveChart.SetSourceData Source:=Range("'With_Cover'!D1:D" & sRow & ",'With_Cover'!F1:F" & sRow)ĪctiveChart.Location Where:=xlLocationAsNewSheetĪctiveChart.ChartType = xlXYScatterSmoothNoMarkersĪctiveChart.SetSourceData Source:=Range("'" & sSheetName & "'!D1:D" & sRow & _ 'snXaxisCrossing = AxisCrossing(snXaxisCrossing) If lSheet > 1 And snYaxisCross 1 And snXaxisCross < snXaxisCrossing Then snXaxisCrossing = snXaxisCross If lSheet = 1 Then snYaxisCrossing = snYaxisCross SnYaxisCross = AxisCrossing(snYaxisCross) The problem is when I go to the second set of data I tried to record a Macro with 2 sets of data, but it got confused and I got no where. But now I want to be able to add multiple data sets on the same Chart. I first recorded a macro with one set of data, X and Y values and that works fine along with your assistance on LineStyle. Please remember to mark the replies as answers if they help and unmark them if they provide no help.
#EXCEL TRENDLINE SCATTER PLOT MULTIPLE DATA CODE#
MSDN Community Support | Feedback to us Get or Request Code Sample from Microsoft
#EXCEL TRENDLINE SCATTER PLOT MULTIPLE DATA HOW TO#
How to create a column chart with two Y-axes in Excel. Please check them and see if they could help you. Would you mind simplify a project or steps and sharing it with us? So I could use it on my side to get a better understanding.Īlso here are some resources about similar topic. If you are looking for a way by code, what do you mean "more than one data set"? Do you mean use SetSourceData method for this chart? As we could see the scenario in UI, we could set data by right-clicking chart and choosing Select data. If the is not what you want, would you please clarify some points for us? Are you looking for a programming way for this issue? If yes, first please try to record a macro for this goal, and you will refer to VBA code.

That's certainly possible and sometimes useful, but wonder if that's what you really It suggests you have an embedded chart ("chart 1") on a chart-sheet named "Chart8".
#EXCEL TRENDLINE SCATTER PLOT MULTIPLE DATA SERIES#
With the worksheet active run the followingįor your purposes, adding series etc, you will want to be dealing with "cht". Try this - in a new workbook insert a simple embedded chart on a worksheet. I used the function ActiveChart.Name and received back "Chart8 Chart1" Now Chart8 is the only Chart in the workbook.Įmbedded charts have two names. Now it doesn't matter if the chart becomes non-active as long as you maintain the object reference "cht". Very simple, if the chart you want to deal with is active (before starting your code), start like this Then without that line almost everything is perfect. When I had the operation wks.Activate it also caused the ActiveChart object get set to Nothing. I'm confused, what's the difference between Seriescollection.add and Add Series The SeriesCollection.Add works great and does exactly what I want. I don't follow what you mean by picking up the "row number" I tried the Add Series and the process seem to get confused as it picked up the row number too.
