Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

vba code for manual calculation with iteration

Status
Not open for further replies.

gromm

Programmer
Feb 21, 2003
12
PH
Hi!

Is it possible to compute values in an Excel table after every iteration. The calculation in my MS Excel worksheet is set to manually calculate with an iteration of 50.

It generates a table that displays values of accumulated total after each iteration.

I'm having problems doing this because I could not find a procedure that would compute for the values after each iteration. I'm supposed to have an accumulated total at the end of the 50 iteration.

Thanks so much in advance for your help!
:)

gromm
 
Just a thought . . .

could you not set the iterations to 1 and then make a loop that calculates manually 50 times

dim counter ' a counter
dim number(50) 'data you are collecting

For counter =1 to 50
'get data
number(counter) = range("c3").value
calculate
next counter


You can either put the data into an array or copy it into other cells within the loop

Hope this helps

Chris
 
Thanks! :)

I did something similar to that. By getting the maximum iteration then replacing the value to 1. We did this, because our user would want to be able to change the maximum iteration of the file. The problem with this, however, is that when it processess, the recalculation becomes very slow. I searched for this and I found that I just have to set the screen updating at the start of the code to "false". Do you think this is ok or is there another way of doing so?

Another question, is it possible to override a built-in function key in MS Excel like [F9]?

Thanks again!
 
can you explain more of what you are doing. What are the iterations for and why does the # change.

and yes I have used the
screenupdating = false code

I think you can overrid the F9 if you want


Chris
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top