VBA xlBarClustered如何区分两个不同的预设? [英] VBA xlBarClustered how do you distinguish between the two different presets?

查看:141
本文介绍了VBA xlBarClustered如何区分两个不同的预设?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用xlBarclustered图表类型保存的图表模板.我希望它基于左侧的默认图表(请参见下图),但它选择的是右侧.我还有另一个文档,上面有选择正确的相同代码的副本.有可能区分吗? 使用记录宏时,左右图表具有相同的代码,复制到下面.

I have a chart template saved using the xlBarclustered chart type. I want it to be based upon the left default chart (see image below) but it chooses right. I have another document with a copy of the same code that chooses right. Is it possible to distinguish? When using record macro it has the same code for both left and right charts which is copied below.

谢谢

Set cht = WS_FS.Shapes.AddChart2(216, xlBarClustered, Left:=WS_FS.Cells(row, 5).Left, Top:=WS_FS.Cells(row, 5).Top, Width:=425, Height:=250)
cht.Chart.SetSourceData Source:=rng

推荐答案

您需要更改数据绘制方式:

You need to change how the data is plotted:

cht.Chart.SetSourceData Source:=rng PlotBy:=xlColumns

获取左侧图表:

cht.Chart.SetSourceData Source:=rng PlotBy:=xlRows

这篇关于VBA xlBarClustered如何区分两个不同的预设?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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