1)问题创建使用宏
我想用宏为我的原始数据结构图, 我的原始数据是在很多.xls文件的文件夹中,全部安排像波纹管:
A1 ........空白 A(空白)---------空白
我需要在1个.xls文件在不同片材的每一列布置,这样
数据(sheet1)数据(sheet2)直到空白... col UMN A列B,直到空白......
2)问题是我需要循环这个宏很容易地创建图形...真的appriciated帮助
Sub Macro1()
'
' Macro1 Macro
'
' Keyboard Shortcut: Ctrl+g
ActiveSheet.Shapes.AddChart.Select
ActiveChart.ChartType = xlLine
ActiveChart.ApplyChartTemplate (_
"C:\Users\bukharms\AppData\Roaming\Microsoft\Templates\Charts\analysis.crtx")
ActiveSheet.ChartObjects("Ambient").Activate
ActiveChart.SeriesCollection(1).Values = "='data'!$B$2:$B$298"
ActiveChart.SeriesCollection(1).Values = "='data (2)'!$B$2:$B$298"
ActiveChart.SeriesCollection(2).Values = "='data (3)'!$B$2:$B$261"
ActiveChart.SeriesCollection(3).Values = "='data (4)'!$B$2:$B$243"
ActiveChart.SeriesCollection(4).Values = "='data (5)'!$B$2:$B$265"
ActiveChart.SeriesCollection(5).Values = "='data (6)'!$B$2:$B$307"
ActiveChart.SeriesCollection(6).Values = "='data (7)'!$B$2:$B$728"
ActiveSheet.Shapes.AddChart.Select
ActiveChart.ChartType = xlLine
ActiveChart.ApplyChartTemplate (_
"C:\Users\bukharms\AppData\Roaming\Microsoft\Templates\Charts\analysis.crtx")
ActiveSheet.ChartObjects("Coolant Into Engine").Activate
ActiveChart.SeriesCollection(1).Values = "='data'!$C$2:$C$298"
ActiveChart.SeriesCollection(1).Values = "='data (2)'!$C$2:$C$298"
ActiveChart.SeriesCollection(2).Values = "='data (3)'!$C$2:$C$261"
ActiveChart.SeriesCollection(3).Values = "='data (4)'!$C$2:$C$243"
ActiveChart.SeriesCollection(4).Values = "='data (5)'!$C$2:$C$265"
ActiveChart.SeriesCollection(5).Values = "='data (6)'!$C$2:$C$307"
ActiveChart.SeriesCollection(6).Values = "='data (7)'!$C$2:$C$728"
ActiveSheet.Shapes.AddChart.Select
ActiveChart.ChartType = xlLine
ActiveChart.ApplyChartTemplate (_
"C:\Users\bukharms\AppData\Roaming\Microsoft\Templates\Charts\analysis.crtx")
ActiveSheet.ChartObjects("Coolant Out from Engine").Activate
ActiveChart.SeriesCollection(1).Values = "='data'!$D$2:$D$298"
ActiveChart.SeriesCollection(1).Values = "='data (2)'!$D$2:$D$298"
ActiveChart.SeriesCollection(2).Values = "='data (3)'!$D$2:$D$261"
ActiveChart.SeriesCollection(3).Values = "='data (4)'!$D$2:$D$243"
ActiveChart.SeriesCollection(4).Values = "='data (5)'!$D$2:$D$265"
ActiveChart.SeriesCollection(5).Values = "='data (6)'!$D$2:$D$307"
ActiveChart.SeriesCollection(6).Values = "='data (7)'!$D$2:$D$728"
您可以使用范围对象的'.end'属性来确定数据的结束位置。 – Pynner