|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
请高手帮忙看看,为什么出现错误,感谢!
Sub Macro1()
'
' Macro1 Macro
' 宏由 录制,时间: 2014-4-19
'
' 快捷键: Ctrl+b
'
Windows("1111111111111.XLS").Activate
Cells.Select
Selection.Copy
Windows("测试.xls").Activate
ActiveSheet.Paste
Columns("A:A").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlToLeft
Columns("C:C").Select
Selection.Delete Shift:=xlToLeft
Columns("D:H").Select
Selection.Delete Shift:=xlToLeft
Columns("G:AC").Select
Selection.Delete Shift:=xlToLeft
Selection.Delete Shift:=xlToLeft
Range("B2:B64").Select
ActiveWindow.SmallScroll Down:=-60
Range("B2:B192").Select
ActiveWindow.SmallScroll Down:=-195
Range("F2:F1214").Select
ActiveWindow.LargeScroll Down:=-1
ActiveWindow.ScrollRow = 1151
ActiveWindow.ScrollRow = 1145
ActiveWindow.ScrollRow = 1135
ActiveWindow.ScrollRow = 1122
ActiveWindow.ScrollRow = 1108
ActiveWindow.ScrollRow = 1096
ActiveWindow.ScrollRow = 1086
ActiveWindow.ScrollRow = 1075
ActiveWindow.ScrollRow = 1063
ActiveWindow.ScrollRow = 1049
ActiveWindow.ScrollRow = 1037
ActiveWindow.ScrollRow = 1028
ActiveWindow.ScrollRow = 1020
ActiveWindow.ScrollRow = 1012
ActiveWindow.ScrollRow = 1002
ActiveWindow.ScrollRow = 994
ActiveWindow.ScrollRow = 977
ActiveWindow.ScrollRow = 963
ActiveWindow.ScrollRow = 955
ActiveWindow.ScrollRow = 928
ActiveWindow.ScrollRow = 892
ActiveWindow.ScrollRow = 847
ActiveWindow.ScrollRow = 798
ActiveWindow.ScrollRow = 755
ActiveWindow.ScrollRow = 716
ActiveWindow.ScrollRow = 695
ActiveWindow.ScrollRow = 675
ActiveWindow.ScrollRow = 655
ActiveWindow.ScrollRow = 632
ActiveWindow.ScrollRow = 593
ActiveWindow.ScrollRow = 571
ActiveWindow.ScrollRow = 555
ActiveWindow.ScrollRow = 518
ActiveWindow.ScrollRow = 501
ActiveWindow.ScrollRow = 483
ActiveWindow.ScrollRow = 465
ActiveWindow.ScrollRow = 444
ActiveWindow.ScrollRow = 428
ActiveWindow.ScrollRow = 407
ActiveWindow.ScrollRow = 379
ActiveWindow.ScrollRow = 367
ActiveWindow.ScrollRow = 356
ActiveWindow.ScrollRow = 344
ActiveWindow.ScrollRow = 342
ActiveWindow.ScrollRow = 332
ActiveWindow.ScrollRow = 318
ActiveWindow.ScrollRow = 299
ActiveWindow.ScrollRow = 283
ActiveWindow.ScrollRow = 269
ActiveWindow.ScrollRow = 258
ActiveWindow.ScrollRow = 246
ActiveWindow.ScrollRow = 224
ActiveWindow.ScrollRow = 213
ActiveWindow.ScrollRow = 203
ActiveWindow.ScrollRow = 179
ActiveWindow.ScrollRow = 158
ActiveWindow.ScrollRow = 144
ActiveWindow.ScrollRow = 130
ActiveWindow.ScrollRow = 117
ActiveWindow.ScrollRow = 109
ActiveWindow.ScrollRow = 101
ActiveWindow.ScrollRow = 91
ActiveWindow.ScrollRow = 85
ActiveWindow.ScrollRow = 72
ActiveWindow.ScrollRow = 58
ActiveWindow.ScrollRow = 44
ActiveWindow.ScrollRow = 32
ActiveWindow.ScrollRow = 23
ActiveWindow.ScrollRow = 13
ActiveWindow.ScrollRow = 11
ActiveWindow.ScrollRow = 9
ActiveWindow.ScrollRow = 5
ActiveWindow.ScrollRow = 1
Columns("D:D").Select
Selection.Delete Shift:=xlToLeft
Columns("A:H").Select
ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:= _
"Sheet1!C1:C5").CreatePivotTable TableDestination:="", TableName:="数据透视表1" _
, DefaultVersion:=xlPivotTableVersion10
ActiveSheet.PivotTableWizard TableDestination:=ActiveSheet.Cells(3, 1)
ActiveSheet.Cells(3, 1).Select
With ActiveSheet.PivotTables("数据透视表1").PivotFields("仓库名称")
.Orientation = xlRowField
.Position = 1
End With
With ActiveSheet.PivotTables("数据透视表1").PivotFields("存货编码")
.Orientation = xlRowField
.Position = 2
End With
With ActiveSheet.PivotTables("数据透视表1").PivotFields("存货名称")
.Orientation = xlRowField
.Position = 3
End With
With ActiveSheet.PivotTables("数据透视表1").PivotFields("批号")
.Orientation = xlRowField
.Position = 4
End With
ActiveSheet.PivotTables("数据透视表1").AddDataField ActiveSheet.PivotTables("数据透视表1" _
).PivotFields("现存数量"), "计数项:现存数量", xlCount
Range("E9").Select
ActiveSheet.PivotTables("数据透视表1").PivotFields("计数项:现存数量").Function = xlSum
Cells.Select
Selection.Copy
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet2").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.Copy
ActiveSheet.Paste
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Rows("1:3").Select
Range("A3").Activate
Application.CutCopyMode = False
Selection.Delete Shift:=xlUp
Range("A3").Select
ActiveWindow.SmallScroll Down:=-36
End Sub
|
|