码迷,mamicode.com
首页 > 编程语言 > 详细

vba 批量生成条形图代码

时间:2017-10-03 12:42:52      阅读:306      评论:0      收藏:0      [点我收藏+]

标签:lin   sub   tchar   tick   line   art   sid   chart   ide   

Sub hong3()

‘ 宏3 宏d
Dim a, b As Integer
Dim str As String
For a = 227 To 947 Step 15
b = a + 5
str = "Sheet1!B" + CStr(a) + ":G" + CStr(b)
sh = ActiveSheet.Shapes.AddChart2(216, xlBarClustered)
sh.Select
ActiveChart.SetSourceData Source:=Range(str)
ActiveChart.SetElement (msoElementChartTitleNone)
ActiveChart.SetElement (msoElementPrimaryValueGridLinesNone)
ActiveChart.SetElement (msoElementLegendRight)
ActiveChart.SetElement (msoElementPrimaryValueAxisNone)
ActiveChart.HasAxis(xlCategory) = True
With sh
.Top = Range("j" + CStr(a - 1)).Top
.Left = Range("j" + CStr(a - 1)).Left
End With

ActiveChart.Axes(xlCategory).Select
Selection.MajorTickMark = xlOutside
ActiveChart.SetElement (msoElementDataLabelOutSideEnd)
Next a
End Sub

vba 批量生成条形图代码

标签:lin   sub   tchar   tick   line   art   sid   chart   ide   

原文地址:http://www.cnblogs.com/Alex0111/p/7623531.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!