G
GiorgioCTS
I need to automate the process of adding one bubble to a bubble chart. Most
of the code works fine, however, I cannot define the size of the bubble
correctly as it seems that I must use R1-style notation. Any assistance would
be greatly appreciated.
Sub AddBubble()
Dim rng As Variant
Dim rng2 As Variant
Dim rng3 As Variant
Dim rng4 As Variant
Set rng = ActiveCell
ActiveCell.Offset(0, 1).Range("A1").Select
Set rng2 = ActiveCell
ActiveCell.Offset(0, 2).Range("A1").Select
Set rng3 = ActiveCell
ActiveCell.Offset(0, 1).Range("A1").Select
Set rng4 = ActiveCell
ActiveSheet.ChartObjects("BubbleChart").Activate
ActiveChart.ChartType = xlBubble
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(2).XValues = rng2
ActiveChart.SeriesCollection(2).Values = rng3
ActiveChart.SeriesCollection(2).Name = rng
ActiveChart.SeriesCollection(2).BubbleSizes = rng4
ActiveChart.ChartType = xlBubble
End Sub
of the code works fine, however, I cannot define the size of the bubble
correctly as it seems that I must use R1-style notation. Any assistance would
be greatly appreciated.
Sub AddBubble()
Dim rng As Variant
Dim rng2 As Variant
Dim rng3 As Variant
Dim rng4 As Variant
Set rng = ActiveCell
ActiveCell.Offset(0, 1).Range("A1").Select
Set rng2 = ActiveCell
ActiveCell.Offset(0, 2).Range("A1").Select
Set rng3 = ActiveCell
ActiveCell.Offset(0, 1).Range("A1").Select
Set rng4 = ActiveCell
ActiveSheet.ChartObjects("BubbleChart").Activate
ActiveChart.ChartType = xlBubble
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(2).XValues = rng2
ActiveChart.SeriesCollection(2).Values = rng3
ActiveChart.SeriesCollection(2).Name = rng
ActiveChart.SeriesCollection(2).BubbleSizes = rng4
ActiveChart.ChartType = xlBubble
End Sub