Link to home
Start Free TrialLog in
Avatar of Jimbo99999
Jimbo99999Flag for United States of America

asked on

VB.Net - Excel Sum Column Values Referencing Column With A Variable

Good Day Experts!

I am having a bit of trouble here trying to figure out my SUM formula using variable for the column.  I can figure it out with a variable for the row end.

This works if I hard code the Column:

oSheet.Cells(DataRow + 2, ColumnStart).Formula = "=SUM(C7:C" & (DataRow) & ")"

Is it possible to use variable on Column reference?

Thanks,
jimbo99999
ASKER CERTIFIED SOLUTION
Avatar of ChloesDad
ChloesDad
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Jimbo99999

ASKER

Thanks CholesDad...I will try it now!
I have just noticed that I have an extra .Formula in the number part. This should be removed.
It is working now!

Thanks for helping.  

I have several other Excel formatting things I will need to be doing, but this is good to get it out of the way.

Thanks again,
jimbo99999