Office中国论坛/Access中国论坛
标题:
请高手帮忙优化我录制的宏(蓝色字体用循环表达出来)
[打印本页]
作者:
isaaclee
时间:
2009-12-16 00:06
标题:
请高手帮忙优化我录制的宏(蓝色字体用循环表达出来)
Application.ScreenUpdating = False
Windows("ST1&ST2.xls").Activate
Sheets("ST1").Select
Range("B8:CG137").ClearContents
Sheets("ST2").Select
Range("B8:CG137").ClearContents
Windows("majus.csv").Activate
Sheets("majus").Select
Columns("C:H").Select
Selection.Delete Shift:=xlToLeft
Range("A1").Select
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="ST"
Selection.AutoFilter Field:=2, Criteria1:="1"
Range("A6:C6").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("majus").Select
Sheets.Add
ActiveSheet.Paste Link:=True
Range("C2:C130").Cut
Range("D1").Select
ActiveSheet.Paste
Range("D2:129").Cut
Range("E1").Select
ActiveSheet.Paste
......
Range("DZ2:Z3").Cut
Range("EA1").Select
ActiveSheet.Paste
Range("EA2:EA2").Cut
Range("EB1").Select
ActiveSheet.Paste
Range("A2:C2").Select
Range(Selection, Selection.End(xlDown)).ClearContents
Range("A1:EB1").AutoFill Destination:=Range("A1:EB128"), Type:=xlFillDefault
Range("A1").Select
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="FP"
Range("C4:EB121").Copy
Windows("ST1&ST2.xls").Activate
Sheets("ST1").Select
Range("B8").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, Transpose:=True
Windows("majus.csv").Activate
Selection.AutoFilter Field:=1, Criteria1:="FR"
Range("C5:EB122").Copy
Windows("ST1&ST2.xls").Activate
Range("P8").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, Transpose:=True
Windows("majus.csv").Activate
Selection.AutoFilter Field:=1, Criteria1:="FZ"
Range("C6:EB123").Copy
Windows("ST1&ST2.xls").Activate
Range("AD8").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, Transpose:=True
Windows("majus.csv").Activate
Selection.AutoFilter Field:=1, Criteria1:="RP"
Range("C7:EB124").Copy
Windows("ST1&ST2.xls").Activate
Range("AR8").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, Transpose:=True
Windows("majus.csv").Activate
Selection.AutoFilter Field:=1, Criteria1:="RR"
Range("C8:EB125").Copy
Windows("ST1&ST2.xls").Activate
Range("BF8").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, Transpose:=True
Windows("majus.csv").Activate
Selection.AutoFilter Field:=1, Criteria1:="RZ"
Range("C9:EB126").Copy
Windows("ST1&ST2.xls").Activate
Range("BT8").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, Transpose:=True
作者:
pureshadow
时间:
2009-12-16 10:19
录出来的宏,有些东东确实多余,比如:
range().select
selection.copy
这种就可以改成:
range().copy
其他类推
作者:
isaaclee
时间:
2009-12-27 21:29
请版主帮忙解决。
作者:
方漠
时间:
2009-12-28 13:09
请上传你的附件,并且解释清楚你的需求.
比如此段代码用来做什么什么之类的.
欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/)
Powered by Discuz! X3.3