如何使用VBA切换图表的系列和类别 [英] How to Switch a Chart's Series and Category Using VBA

查看:560
本文介绍了如何使用VBA切换图表的系列和类别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Excel 2013.  VBA。



我有一张名为"DataChart"的图表 我以编程方式设置其数据范围。 当我这样做时,图表会翻转系列和类别。 我知道如何通过单击"切换行/列"来手动切换它们。按钮
下的"选择数据源"按钮对话群组。但是,我也希望以编程方式执行此操作。 任何人都知道如何实现这一目标? 我手动操作时尝试录制宏,但宏中没有存储有用的代码。 感谢
任何帮助!



Doug Pruiett

Excel 2013.  VBA.

I have a chart named "DataChart"  I set its data range programmatically.  When I do that, the chart flips the series and category.  I know how to manually switch these back by clicking the "Switch Row/Column" button under the "Select data Source" dialogue.  However, I want to do this programmatically as well.  Anyone know how to accomplish that?  I tried recording a macro while doing it manually, but the macro stored no helpful code.  Thanks for any help!


Doug Pruiett

推荐答案

嗨道格

ActiveChart.PlotBy = xlColumns

ActiveChart.PlotBy = xlColumns

ActiveChart.PlotBy = xlRows

ActiveChart.PlotBy = xlRows

我希望有所帮助。

干杯,卢卡


这篇关于如何使用VBA切换图表的系列和类别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆