英文:
Dynamically find the sum values of range of cells in Excel VBA
问题
请问如何使用Excel宏动态查找每一行的总付款,直到最后一个非空行?
即将单元格("B2"、"C2"、"D2")的总和存储在单元格("E2"),然后重复这个操作直到最后一个非空行。请参阅上面的工作表。
英文:
Please how can find the Total Payment for each of the rows dynamically till the last non-empty row using Excel macro?
That is storing the sum of Cell ("B2", "C2", 'D2") in Cell("E2), the same with next row till the end non-empty row. See the above sheet.
答案1
得分: 0
抱歉,但我看不到任何表格。尝试检查此宏是否适用于您。
Sub Sum_Total_LastNONemptycell()
Dim i As Integer
For i = 2 To Range("B1000000").End(xlUp).Row
Range("E" & i).Value = WorksheetFunction.Sum(Range("B" & i).Value, Range("C" & i).Value, Range("D" & i).Value)
Next i
End Sub
英文:
Sorry, but i can't see any sheet here. Still i tried check this Macro if it works for you.
Sub Sum_Total_LastNONemptycell()
Dim i As Integer
For i = 2 To Range("b1000000").End(xlUp).Row
Range("E" & i).Value = WorksheetFunction.Sum(Range("B" & i).Value, Range("C" & i).Value, Range("D" & i).Value)
Next i
End Sub
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论