using a formula in a program

  • Thread starter Thread starter Ed
  • Start date Start date
E

Ed

I'm trying to write a program which will use the formula
("=SUMIF(AA8:AA208,3,C8:C208)" in a loop, except that I'd like to change the
integer "3" in the formula to a variable so that I can increase this value
each time through the loop.

The program works as long as I leave the value an integer "3". "4", etc. But
I can't make it work with a variable.

Can someone give me a boost that might help me with this problem?

Thanks
 
Posting your code would have been helpful. Assuming your variable's name is
MyVar, I think this is what you are looking for..

MyVar = 4
<whatever you are assigning to> = "=SUMIF(AA8:AA208," & MyVar & ",C8:C208"

Rick
 
Thanks very much Rick. I'll give it a try.


Rick Rothstein (MVP - VB) said:
Posting your code would have been helpful. Assuming your variable's name
is MyVar, I think this is what you are looking for..

MyVar = 4
<whatever you are assigning to> = "=SUMIF(AA8:AA208," & MyVar & ",C8:C208"

Rick
 

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

Back
Top