練習問題6(変数を使っての合計の練習)メモ
Sub Practice6()
Dim i As Long
Dim lngTotal As Long
Dim lastRow As Long
lngTotal = 0
lastRow = Cells(Rows.Count, 1).End(xlUp).Row
For i = 2 To lastRow
Cells(i, 4) = Cells(i, 2) * Cells(i, 3)
lngTotal = lntTotal + Cells(i, 4)
Next
Cells(lastRows + 1, 4) = lngTotal
End Sub