ALT+F11打开VBA编辑器,粘贴以下代码,F5运行,在第一个工作表中的G列显示结果。Sub sumsheet()Dim i, j As IntegerDim esum, fsum As DoubleDim sh As Worksheetesum = 0fsum = 0For Each sh In Worksheets sh.Select j = Range("f65535").End(xlUp).Row fsum = fsum + Cells(j, 6) For i = j To 1 Step -1 If Cells(i, 5) < 0 Then esum = esum + Cells(i, 5) End If NextNextSheet1.Cells(1, 7) = "E列和" & esumSheet1.Cells(2, 7) = "F列和" & fsumEnd Sub
描述不是很精确。可以按下 Alt+= ,然后鼠标拖选要累加的区域。
- 上一篇: 散文开头结尾摘抄励志?
- 下一篇: 返回列表