montecarlo2012
Well-known Member
- Joined
- Jan 26, 2011
- Messages
- 984
- Office Version
- 2010
- Platform
- Windows
Hi.
I make it work some simple and basic loop, the idea just add each row on column A and B and the total on C, for that I write the following code and work good.
for this little peace of data
Now, here is my problem, I just tried to keep the same logic I use for this one, just change the A, B and C for names, then do not work.
this is the code I use the same logic
So of course I am missing something here,
Please, I need some logic here, what I have to change to make it work,
Thanks for reading this.
<tbody>
</tbody>
I make it work some simple and basic loop, the idea just add each row on column A and B and the total on C, for that I write the following code and work good.
VBA Code:
Sub g_one()
Dim x As Long, y As Long
For x = 1 To 4
For y = 1 To 2
Cells(x, "C").Value = Cells(x, "A").Value + Cells(x, "B").Value
Next y
Next x
End Sub
Now, here is my problem, I just tried to keep the same logic I use for this one, just change the A, B and C for names, then do not work.
this is the code I use the same logic
VBA Code:
Sub Name_per_column()
Dim x As Long, y As Long
For x = 1 To 5
For y = 6 To 7
Cells(x, "total").Value = Cells(x, "payment").Value * Cells(x, "hour").Value
Next y
Next x
End Sub
Please, I need some logic here, what I have to change to make it work,
Thanks for reading this.
<tbody>
20 | 80 | 100 | payment | hours | total | ||
30 | 70 | 100 | 60 | 40 | |||
40 | 60 | 100 | 70 | 30 | |||
50 | 50 | 100 | 80 | 20 | |||
90 | 10 | ||||||