VBA Formula Excel 2007

H

harm.charles

Hi,

I created a vba code to sum values in several columns. Column "D" thru
"O" the code works when ran I see the correct values. Now lets say my
code is placed in E18 and the formula is Sum(E15:E17) and the code
will be similar for the other columns. There is a empty cell above and
below the range I'm using. The value like I said is correct, until I
do a save and now the formula show the range extended like this
Sum(E13:E17). Now there is a value in E13, but I do not want that to
be added to my total in E18.
I'm using Excel 2007.

Any thought would be appreciated.
 
H

harm.charles

You can't use VBA code actually ina worksheet no matter which version of
Excel you are using!, if you mean you have a formula then thats
different, why extend the range to E13 when you don't want to include
it? anyway =SUM(E13:E17)-E13




--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' (http://www.thecodecage.com)

Thanks for the reply.
I know you can not use vba code in a worksheet so my question must be
mis leading. The code I created is like this
"Range("D" & Rlrow + Mynum + 1 & ":O" & Rlrow + Mynum + 1).FormulaR1C1
= "=SUM(r[-" & Mynum & "]c:rc)""
of which this forum helped me on.
It place the correct formula in the worksheet and the value is
correct. What happens (and i visually saw this) is when I saved the
project the the values that was correct changed and up on looking at
the formula in the cell it changed to include a cell 2 row above the
range I desired. I can not understand why upon the save will and did
change the formula.
I hope this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top