vba 批量生成条形图代码

Posted Alex0111

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了vba 批量生成条形图代码相关的知识,希望对你有一定的参考价值。

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 批量生成条形图代码的主要内容,如果未能解决你的问题,请参考以下文章

Excel 如何在EXCEL中批量的自动生成条形码

如何实现excel数据导入批量生成二维码

用python批量执行VBA代码

批量生成缩略图

表格批量导入金蝶专业版销售订单

如何批量生成每组数据的雷达图?