|
本帖最后由 chzsh 于 2024-1-5 16:15 编辑
Sub qiuhe()
Dim i, r, k
k = Sheets.Count
For i = 2 To k
With Sheets(i)
r = .Cells(.Rows.Count, "f").End(xlUp).Row
.Range("e" & r + 1) = "合计"
.Range("f" & r + 1) = Application.WorksheetFunction.Sum(.Range("f6:f" & r))
.Range("g" & r + 1) = Application.WorksheetFunction.Sum(.Range("g6:g" & r))
.Range("h" & r + 1) = Application.WorksheetFunction.Sum(.Range("h6:h" & r))
Sheets(1).Range("a" & i) = Sheets(i).Name
Sheets(1).Range("b" & i).Resize(1, 3) = .Range("f" & r + 1).Resize(1, 3).Value
End With
Next
With Sheets(1)
.Range("a" & k + 1) = "合计"
.Range("b" & k + 1) = Application.WorksheetFunction.Sum(.Range("b2:b" & k))
.Range("c" & k + 1) = Application.WorksheetFunction.Sum(.Range("c2:c" & k))
.Range("d" & k + 1) = Application.WorksheetFunction.Sum(.Range("d2:d" & k))
End With
End Sub
|
评分
-
1
查看全部评分
-
|