1) 问题
我想将宏用于我的原始数据排列,我的原始数据位于文件夹中的许多 .xls 文件中,所有排列如下:
A1 ........ 空白 A(Blank) --------- 空白
我需要在 1 个 .xls 文件中的不同工作表中排列每一列,就像这样
数据(sheet1)数据(sheet2)直到空白...列A 列B直到空白...
2)问题是我需要循环这个宏以便于创建图形......真的很感激帮助
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"