Hello,
i am trying to do a simple task with VBA but code is not working. I need to add Column N,Q,T.... In other words every 3 column
i have the following code
The macro runs but it doesn't give me the right answer. for example the answer in column 79 or 'CA' should be following
[TABLE="width: 64"]
<tbody>[TR]
[TD="class: xl90, width: 64"]1[/TD]
[/TR]
[TR]
[TD="class: xl90"]5[/TD]
[/TR]
[TR]
[TD="class: xl90"]39[/TD]
[/TR]
[TR]
[TD="class: xl90"]1[/TD]
[/TR]
[TR]
[TD="class: xl90"]1[/TD]
[/TR]
[TR]
[TD="class: xl90"]4[/TD]
[/TR]
[TR]
[TD="class: xl90"]36[/TD]
[/TR]
[TR]
[TD="class: xl90"]0[/TD]
[/TR]
</tbody>[/TABLE]
But macro gives the following answer
[TABLE="width: 64"]
<tbody>[TR]
[TD="class: xl90, width: 64"]1[/TD]
[/TR]
[TR]
[TD="class: xl90"]6[/TD]
[/TR]
[TR]
[TD="class: xl90"]45[/TD]
[/TR]
[TR]
[TD="class: xl90"]46[/TD]
[/TR]
[TR]
[TD="class: xl90"]47[/TD]
[/TR]
[TR]
[TD="class: xl90"]51[/TD]
[/TR]
[TR]
[TD="class: xl90"]87[/TD]
[/TR]
[TR]
[TD="class: xl91"]87[/TD]
[/TR]
</tbody>[/TABLE]
which means it adds each row from top to bottom in column 79. I am not sure how to fix it.
Any help is much appreciated.
Thanks
i am trying to do a simple task with VBA but code is not working. I need to add Column N,Q,T.... In other words every 3 column
i have the following code
PHP:
For lrow = 7 To 15
For xcol = 14 To 78 Step 3
'sumx = 0
sumx = sumx + Cells(lrow, xcol).Value
Next xcol
md.Cells(lrow, 79).Value = sumx
Next lrow
The macro runs but it doesn't give me the right answer. for example the answer in column 79 or 'CA' should be following
[TABLE="width: 64"]
<tbody>[TR]
[TD="class: xl90, width: 64"]1[/TD]
[/TR]
[TR]
[TD="class: xl90"]5[/TD]
[/TR]
[TR]
[TD="class: xl90"]39[/TD]
[/TR]
[TR]
[TD="class: xl90"]1[/TD]
[/TR]
[TR]
[TD="class: xl90"]1[/TD]
[/TR]
[TR]
[TD="class: xl90"]4[/TD]
[/TR]
[TR]
[TD="class: xl90"]36[/TD]
[/TR]
[TR]
[TD="class: xl90"]0[/TD]
[/TR]
</tbody>[/TABLE]
But macro gives the following answer
[TABLE="width: 64"]
<tbody>[TR]
[TD="class: xl90, width: 64"]1[/TD]
[/TR]
[TR]
[TD="class: xl90"]6[/TD]
[/TR]
[TR]
[TD="class: xl90"]45[/TD]
[/TR]
[TR]
[TD="class: xl90"]46[/TD]
[/TR]
[TR]
[TD="class: xl90"]47[/TD]
[/TR]
[TR]
[TD="class: xl90"]51[/TD]
[/TR]
[TR]
[TD="class: xl90"]87[/TD]
[/TR]
[TR]
[TD="class: xl91"]87[/TD]
[/TR]
</tbody>[/TABLE]
which means it adds each row from top to bottom in column 79. I am not sure how to fix it.
Any help is much appreciated.
Thanks