|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
本帖最后由 zhujiayi1991 于 2016-10-10 15:03 编辑
用vba将一个excel拆分成多个Excel文件,同时各个excel根据表中数据生成折线图,因为每张表区域不同,所以选择区域用一下这句出来图是空的
下面是录制的宏,没有报错,问题应该出现在标示出来的红色字体部分。 ActiveChart.SetSourceData Source:=Range("A23:H" & [H65536].End(xlUp).Row)
- ActiveSheet.Shapes.AddChart.Select
- ActiveChart.ChartType = xlLine
- ActiveChart.SeriesCollection.NewSeries
- ActiveChart.SeriesCollection(1).Name = "=Sheet4!$A$24"
- ActiveChart.SeriesCollection(1).Values = "=Sheet4!$B$24:$H$24"
- ActiveChart.SeriesCollection(1).XValues = "=Sheet4!$B$23:$H$23"
- ActiveChart.SetSourceData Source:=Range("A23:H" & [H65536].End(xlUp).Row)
- ActiveWindow.SmallScroll Down:=-105
- ActiveChart.Legend.Select
- Selection.Delete
- ActiveChart.Shapes.AddTextbox(msoTextOrientationHorizontal, 141.75, _
- 16.8750393701, 78, 18.75).Select
- Selection.ShapeRange(1).TextFrame2.TextRange.Characters.Text = "BF调整结果"
- Selection.ShapeRange(1).TextFrame2.TextRange.Characters(1, 6).ParagraphFormat. _
- FirstLineIndent = 0
- With Selection.ShapeRange(1).TextFrame2.TextRange.Characters(1, 2).Font
- .NameComplexScript = "+mn-cs"
- .NameFarEast = "+mn-ea"
- .Size = 11
- .Name = "+mn-lt"
- End With
- With Selection.ShapeRange(1).TextFrame2.TextRange.Characters(3, 4).Font
- .NameComplexScript = "+mn-cs"
- .NameFarEast = "+mn-ea"
- .Size = 11
- .Name = "+mn-lt"
- End With
复制代码
想要的得到的图
|
|