[英]Chart returns different results depending on size of range
I try to make program in macro-excel that show chart of dec 2012- curent month data. 我尝试在macro-excel中制作程序,以显示2012年12月至今的月度数据图表。
I want X-axis is the month, but only in january, the axis n the legend switched. 我希望X轴是月份,但仅在1月份,图例的轴已切换。
My code: 我的代码:
Public Sub pi()
Dim bulan1
Dim bulan2
Dim kpi As Worksheet
Dim data As Worksheet
Dim a As Integer
Dim x As Integer
Dim xaxis As Axis
Set kpi = ThisWorkbook.Sheets("KPI chart")
Set data = ThisWorkbook.Sheets("data")
bulan1 = Month(Now)
For a = 2 To 14
bulan2 = Month(Cells(54, a).Value)
If bulan2 = bulan1 Then
End If
Next
kpi.ChartObjects("Chart 16").Activate
ActiveChart.SetSourceData Source:=Range(data.Cells(54, 1), data.Cells(57, a))
End Sub
Picture : http://melegenda.tumblr.com/image/72825632452 图片: http : //melegenda.tumblr.com/image/72825632452
I think I missed something? 我想我错过了什么? (I use excel 2007)
(我使用Excel 2007)
I don't know what is this, but it works. 我不知道这是什么,但是可以。 ahhaha just add
ActiveChart.PlotBy = xlRows
before end sub
ahhaha只需在
end sub
之前添加ActiveChart.PlotBy = xlRows
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.