montecarlo2012
Well-known Member
- Joined
- Jan 26, 2011
- Messages
- 984
- Office Version
- 2010
- Platform
- Windows
Hi, everyone, merry Christmas and thanks all you for your time and teaching I got from you.
I am practicing a little bit about loops, so trying to sum rows by rows I got this
what about if I want to sum column by column like for example
and what about if I want to sum a column two number each time I go down, example
I want to understand how to loop operations . thanks.
I am practicing a little bit about loops, so trying to sum rows by rows I got this
Code:
Sub addrows()
Dim x As Long 'ROWS
Dim y As Long 'COLUMNS
For x = 1 To Cells(Rows.Count, "A").End(xlUp).Row
For y = 1 To 3
Cells(x, "H").Value = Cells(x, "H").Value + Cells(x, y).Value
Next
Next
End Sub
1 | 4 | 7 |
2 | 5 | 8 |
3 | 6 | 9 |
6 | 15 | 24 |
and what about if I want to sum a column two number each time I go down, example
1 | ||||
2 | 3 | |||
3 | 6 | |||
4 | 10 | |||
5 | 15 |
I want to understand how to loop operations . thanks.
Last edited by a moderator: