variables inside a formula??

Z

zerosleep

here's what I have
ActiveCell.FormulaR1C1 = "=sum(R[-176]C:R[-1]C)"

trouble is the rows are not always the same and I want to use a
variable
instead of a fix number.

ActiveCell.FormulaR1C1 = "=sum(R[variableX]C:R[variableY]C)"
variableX being the top of the column and variableY being the cell
above the
active cell. I can't seem to get it to recognize variableX and
variableY

I thought this would be simple enough, but it's driving me
nuts.:confused: :confused:
 
U

Udo

Hi zerosleep,

try to connect the different parts of the formula like text:
ActiveCell.FormulaR1C1 = "=Sum(R[-" & (Var1- (Var2 + 1)) & "]C:R[-1]C)"

Hope this helps and you can again sleep fine (at least at home)

Udo
 
Z

zerosleep

thank you Udo!

that helped alot. I tried all that, but I couldn't get the " and the &

straight so it didn't work for me. thanks to you I was able to see
how that works and now everything is peachy...:)

I should just head home and crawl into bed! THANKS again.
 

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