A
A Whelan
hi i can create a chart with one set of data from range a1 to a10 using the
below code
can someone please advise me how to add a second set of data to the the
chart i.e so the full data range woul be from a1 to b10
Public Sub cSheet()
Dim dataRange As Range
Set dataRange = Range("A2:a10")
Charts.Add
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = "hello"
.ChartType = xlColumnClustered
.HasLegend = True
.Legend.Position = xlRight
.Axes(xlCategory).MinorTickMark = xlOutside
.Axes(xlValue).MinorTickMark = xlOutside
.Axes(xlValue).MaximumScale =
Application.WorksheetFunction.RoundUp(Application.WorksheetFunction.Max(dataRange),
-1)
.Axes(xlCategory).HasTitle = True
.Axes(xlCategory).AxisTitle.Characters.Text = "Harry"
.Axes(xlValue).HasTitle = True
.Axes(xlValue).AxisTitle.Characters.Text = "Andy"
.SeriesCollection(1).Name = "Sample Data"
.SeriesCollection(1).Values = dataRange
End With
End Sub
below code
can someone please advise me how to add a second set of data to the the
chart i.e so the full data range woul be from a1 to b10
Public Sub cSheet()
Dim dataRange As Range
Set dataRange = Range("A2:a10")
Charts.Add
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = "hello"
.ChartType = xlColumnClustered
.HasLegend = True
.Legend.Position = xlRight
.Axes(xlCategory).MinorTickMark = xlOutside
.Axes(xlValue).MinorTickMark = xlOutside
.Axes(xlValue).MaximumScale =
Application.WorksheetFunction.RoundUp(Application.WorksheetFunction.Max(dataRange),
-1)
.Axes(xlCategory).HasTitle = True
.Axes(xlCategory).AxisTitle.Characters.Text = "Harry"
.Axes(xlValue).HasTitle = True
.Axes(xlValue).AxisTitle.Characters.Text = "Andy"
.SeriesCollection(1).Name = "Sample Data"
.SeriesCollection(1).Values = dataRange
End With
End Sub