Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Adding values to a bubble chart

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Adding values to a bubble chart

Assuming you are putting valid data in your range variables, try changing
the second part of your routine as follows -

With ActiveSheet.ChartObjects("BubbleChart").Chart
.SeriesCollection.NewSeries
With .SeriesCollection(.SeriesCollection.Count)
.XValues = rng2
.Values = rng3
.Name = rng
.BubbleSizes = rng4
End With
End With

Regards,
Peter T


"GiorgioCTS" wrote in message
...
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Adding values to a bubble chart

I still get a debug error on the line ".BubbleSizes = rng4". The bubble sizes
are in percentages, which when I add the data manually, works. I have also
tried changing the data to comma format numbers and still the code stops at
this line.



"Peter T" wrote:

Assuming you are putting valid data in your range variables, try changing
the second part of your routine as follows -

With ActiveSheet.ChartObjects("BubbleChart").Chart
.SeriesCollection.NewSeries
With .SeriesCollection(.SeriesCollection.Count)
.XValues = rng2
.Values = rng3
.Name = rng
.BubbleSizes = rng4
End With
End With

Regards,
Peter T


"GiorgioCTS" wrote in message
...
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




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,489
Default Adding values to a bubble chart

Try,

..BubbleSizes = "='" & rng4.Parent.Name & "'!" _
& rng4.Address(ReferenceStyle:=xlR1C1)

Cheers
Andy

GiorgioCTS wrote:
I still get a debug error on the line ".BubbleSizes = rng4". The bubble sizes
are in percentages, which when I add the data manually, works. I have also
tried changing the data to comma format numbers and still the code stops at
this line.



"Peter T" wrote:


Assuming you are putting valid data in your range variables, try changing
the second part of your routine as follows -

With ActiveSheet.ChartObjects("BubbleChart").Chart
.SeriesCollection.NewSeries
With .SeriesCollection(.SeriesCollection.Count)
.XValues = rng2
.Values = rng3
.Name = rng
.BubbleSizes = rng4
End With
End With

Regards,
Peter T


"GiorgioCTS" wrote in message
...

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





--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Adding values to a bubble chart

Andy, I raise my glass to you as this worked! I assume this code takes a
range and converts it to R1-style notation? Thanks to you (and Peter) and
have a blessed day. Giorgio

"Andy Pope" wrote:

Try,

..BubbleSizes = "='" & rng4.Parent.Name & "'!" _
& rng4.Address(ReferenceStyle:=xlR1C1)

Cheers
Andy

GiorgioCTS wrote:
I still get a debug error on the line ".BubbleSizes = rng4". The bubble sizes
are in percentages, which when I add the data manually, works. I have also
tried changing the data to comma format numbers and still the code stops at
this line.



"Peter T" wrote:


Assuming you are putting valid data in your range variables, try changing
the second part of your routine as follows -

With ActiveSheet.ChartObjects("BubbleChart").Chart
.SeriesCollection.NewSeries
With .SeriesCollection(.SeriesCollection.Count)
.XValues = rng2
.Values = rng3
.Name = rng
.BubbleSizes = rng4
End With
End With

Regards,
Peter T


"GiorgioCTS" wrote in message
...

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




--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding labels to a bubble chart other than the X, Y or Z values Jeff in GA Excel Discussion (Misc queries) 3 September 23rd 09 03:52 AM
Bubble chart with multiple values per series Katherine[_2_] Charts and Charting in Excel 2 July 11th 08 10:49 PM
adding dynamic lines or quadrants to bubble chart? griff Charts and Charting in Excel 2 May 8th 07 09:32 AM
Making a Bubble Chart based on n-values matrix Haydar Charts and Charting in Excel 1 August 8th 05 11:16 PM
How do I move a hidden bubble to the front in a bubble chart in E. Scott Excel Discussion (Misc queries) 0 February 20th 05 07:55 PM


All times are GMT +1. The time now is 05:25 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"