Changing chart data label values and rotation angle (VBA)?

roscoe

Well-known Member
Joined
Jun 4, 2002
Messages
1,046
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
With some help from another (see linky) I was able to use VBA to use the values of a donut chart inputs to set the colors.
559288016_7kLZN-L-4.jpg


(Note - X-1 inner ring to X-6 outer ring, graph is rotated such that "0" azimuth points straight right)

Now...the value I used to create the chart was a gimmick to make it look right...what I need now is to replace each data label (1.0086) with a better number without gorking up the chart. Example: To make the slices all equal size, I took the actual data value to be plotted (e.g. 86%), divided it by 1000 and then added it to one (=1.0086) With all the pie values now all within 1% of each other, each donut slice appears to be an identical 45% wedge.

What I really need is for the label to read 86%, not 1.0086.

Is there a VBA command I can change the value of the label, either by formula or by referencing a cell outside the data range instead (preferred solution as I have more flexibility for making the labels as I develop these charts)? Theoretically I can add it to the code I already have and do it in all in one swell foop.

If not, is there another way to constrain the pie slices to 45 degree wedges, regardless of the value of the underlying data?

Last question...Can I change the rotation angle of each label to match the orientation of the donut? I know in advance what the angle is, just need to know how to do it (if I can do it)

Thanks
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
How did you end up changing the rotation of the text?
I did it manually (not VBA), but now I discover that I really need to know if this is possible in VBA and if so, how...
 
Upvote 0
try starting the macro recorder and rotating the text to see if that gives you the format for VBA.
 
Upvote 0

Forum statistics

Threads
1,214,998
Messages
6,122,639
Members
449,093
Latest member
Ahmad123098

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top