Solved

xlLabelPositionBestFit for Bubble Chart in Excel

Posted on 2012-03-20
3
1,059 Views
Last Modified: 2012-03-22
When I try to set the datalabels position for a bubble chart to xlLabelPositionBestFit, it always fail with error, "Run-time error '91', Object variable or With block variable not set".

When i replace xlLabelPositionBestFit with xlLabelPositionBelow, xlLabelPositionAbove, xlLabelPositionCenter, it works.  

My bubble chart labels just got so jammed together that i need to find a good way to space them out automatically.

Can anyone advise why the above doesn't work, and if there's a simple way to resolve the bubble chart label spacing problem?

Code segment below:
   Set WorkingSheet = Worksheets(ChartSheetName)
   With WorkingChart.SeriesCollection(1)
        .DataLabels.Select
        Selection.Position = xlLabelPositionBelow
   End With


Many thanks in advance for your advice.

Thanks,
Janice
0
Comment
Question by:janicep
3 Comments
 
LVL 85

Accepted Solution

by:
Rory Archibald earned 250 total points
ID: 37741684
Best fit is not an option, either in VBA or in the UI, for data labels on a bubble chart - it only works on Pie charts as far as I know.

I don't know of any way to automatically space them best - my only suggestion would be that if your chart is that cluttered, it may not be the best choice of chart for the situation.
0
 
LVL 19

Assisted Solution

by:regmigrant
regmigrant earned 250 total points
ID: 37741852
I think xlLabelPositionBestFit is only for Pie charts, the others you have to handle manually

Reg
0
 

Author Closing Comment

by:janicep
ID: 37751909
You've both confirmed what I have suspected.  Thank you!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now