使用 VBA 在 excel 中自定义饼图的顺序

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11138388/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-11 16:33:43  来源:igfitidea点击:

Custom ordering of pie slices in excel wtih VBA

excel-vbapie-chartvbaexcel

提问by Eugene

Is there a way to customize the order of the slices of a pie chart in excel (2003, 2007, 2010) with VBA so they're not bunched solely by value?

有没有办法使用 VBA 在 excel (2003, 2007, 2010) 中自定义饼图切片的顺序,这样它们就不会仅仅按值组合在一起?

回答by Eugene

So I don't know why it wasn't working before, but all you do is is reorder the data in the range.

所以我不知道为什么它以前不起作用,但你所做的就是重新排序范围内的数据。

For example to change Item 5 and Item 6's position, simply rearrange. Slice to change

例如,要更改 Item 5 和 Item 6 的位置,只需重新排列即可。 切片改变

like so: enter image description here

像这样: 在此处输入图片说明