|
Sub 过渡()
Application.ScreenUpdating = False
Application.EnableEvents = False
Application.Calculation = xlManual
Sheets("汇总").Rows("2:65536").Clear
For i = 2 To Sheets.Count
With Sheets(i)
k = .[a65536].End(xlUp).Row
Set rng = .Range("a6:l" & k)
j = Sheets("过渡").[a65536].End(xlUp).Row + 1
rng.Copy Sheets("过渡").Range("a" & j)
End With
Next
Application.ScreenUpdating = True
Application.EnableEvents = True
Application.Calculation = xlAutomatic
End Sub
Sub 汇总()
Application.ScreenUpdating = False
Application.EnableEvents = False
Application.Calculation = xlManual
Sheets("汇总").Rows("2:65536").Clear
Dim Arr1, Arr2
Dim N As Integer
Arr1 = Split("A,B,C,D,e,f,g,i,j,l", ",")
Arr2 = Split("b,k,l,c,d,h,m,n,o,p", ",")
For N = LBound(Arr1) To UBound(Arr1)
With Worksheets("汇总")
Worksheets("过渡").Columns(Arr1(N)).Copy .Columns(Arr2(N))
End With
Next N
Application.ScreenUpdating = True
Application.EnableEvents = True
Application.Calculation = xlAutomatic
End Sub
我现在是把各分表数据通过代码集中到“过渡”上,然后再通过“过渡”用代码按条件生成 "汇总",我想请高手帮我合并两个代码为一个代码不用“过渡”直接把各分表数据按汇总条件生成 "汇总"。
[ 本帖最后由 lbl016 于 2010-4-11 08:03 编辑 ] |
|