B
barryjonunattended
Hi,
Please forgive me - I am not great when it comes to Excel VBA. I
believe there is an easy way to sum a column in VBA using the
forumalaR1C1= syntax.
So say I have a report which regularly has a different number of rows.
I want to sum on columns C, D, E, F etc...(all the way to column AT)
where the starting row to be summed is 7 (and obviously the ending row
is something like lngLastRow). I want to insert the "Grand Total" row
on lngLastRow + 1. I know I can explicitly do something like this for
each row;
Cells(lngLastRow+1, 3).Value = "=sum(C7:C" & lngLastRow & ")"
The problem with this is I need to explicitly write a line of code for
each line. Is there a way using the R1C1 method to right a more
generic line and look through the columns? Or am I just completely way
off the mark. If there is a way could you explain how it works or
point me to a good link where it is explained (simply and clearly).
Any help much appreciated.
Barry-Jon
Please forgive me - I am not great when it comes to Excel VBA. I
believe there is an easy way to sum a column in VBA using the
forumalaR1C1= syntax.
So say I have a report which regularly has a different number of rows.
I want to sum on columns C, D, E, F etc...(all the way to column AT)
where the starting row to be summed is 7 (and obviously the ending row
is something like lngLastRow). I want to insert the "Grand Total" row
on lngLastRow + 1. I know I can explicitly do something like this for
each row;
Cells(lngLastRow+1, 3).Value = "=sum(C7:C" & lngLastRow & ")"
The problem with this is I need to explicitly write a line of code for
each line. Is there a way using the R1C1 method to right a more
generic line and look through the columns? Or am I just completely way
off the mark. If there is a way could you explain how it works or
point me to a good link where it is explained (simply and clearly).
Any help much appreciated.
Barry-Jon