|
Sub 增加汇总()
Dim EndRow As Byte, EndCol As Byte, DataArr() As Variant, ToRng As Range, ArrI As Byte
Set ToRng = Worksheets(2).Range("E1048576").End(xlUp).Offset(1, 1)
With ActiveSheet
EndRow = .Range("B11").End(xlDown).Row
EndCol = .Range("B11").CurrentRegion.Columns.Count + 1
DataArr = .Range(.Cells(12, 2), .Cells(EndRow, EndCol)).Value
ReDim Preserve DataArr(1 To UBound(DataArr, 1), 1 To UBound(DataArr, 2) + 1)
For ArrI = 1 To UBound(DataArr, 1)
DataArr(ArrI, UBound(DataArr, 2)) = [C23]
Worksheets(2).Range("B" & ArrI + Worksheets(2).Range("F2").End(xlDown).Row) = [C4]
Worksheets(2).Range("C" & ArrI + Worksheets(2).Range("F2").End(xlDown).Row) = [C5]
Worksheets(2).Range("D" & ArrI + Worksheets(2).Range("F2").End(xlDown).Row) = [H4]
Worksheets(2).Range("E" & ArrI + Worksheets(2).Range("F2").End(xlDown).Row) = [H5]
Next ArrI
ToRng.Resize(UBound(DataArr, 1), UBound(DataArr, 2)) = DataArr
End With
End Sub
工作簿1.zip
(22.82 KB, 下载次数: 11)
|
|