将此转变为for循环的任何帮助将不胜感激。我列出了G列和H列,但需要它去AA。
此致
孙
Sub AutoSum()
Dim Area As Range, MyColumn As String
MyColumn = "G"
For Each Area In Columns(MyColumn).SpecialCells(xlConstants, xlNumbers).Areas
SumAddr = Area.Address(False, False)
Area.Offset(Area.Count, 0).Resize(1, 1).Formula = "=SUM(" & SumAddr & ")"
Next Area
MyColumn = "H"
For Each Area In Columns(MyColumn).SpecialCells(xlConstants, xlNumbers).Areas
SumAddr = Area.Address(False, False)
Area.Offset(Area.Count, 0).Resize(1, 1).Formula = "=SUM(" & SumAddr & ")"
Next Area
End Sub
答案 0 :(得分:0)
对于c = 7到8' G到H
For Each Area In Columns(c).SpecialCells(xlConstants, xlNumbers).Areas SumAddr = Area.Address(False, False) Area.Offset(Area.Count, 0).Resize(1, 1).Formula = "=SUM(" & SumAddr & ")" Next Area
下一个c