|
本帖最后由 excel菜鸟123 于 2016-12-21 15:25 编辑
Sub 求和()
Dim Arr, i&, Myr&
Dim Sht As Worksheet
For Each Sht In Sheets
Myr = [A65536].End(xlUp).Row + 1
If Myr > 1 Then
Cells(Myr, 2).Formula = "=sum(r2c:r[-1]c)"
End If
Next
End Sub
我这样运行的话,怎么只有第一个工作表可以求和啊。哪位帮看下,谢谢!
- Sub 求和()
- Dim Arr, i&, Myr&
- Dim Sht As Worksheet
- For Each Sht In Sheets
- Myr = Sht.Cells(Sht.Rows.Count, 1).End(xlUp).Row + 1
- If Myr > 2 Then
- Sht.Cells(Myr, 2).Formula = "=sum(r2c:r[-1]c)"
- End If
-
- Next
- End Sub
复制代码
|
-
-
2.zip
13.86 KB, 下载次数: 12
2
|