# recalculation in vba

#### okang

##### New Member
Hi. I am trying to write a code by using VB in Excel that can determine the moment-curvature relationship of a reinforced concrete cross section, but I have limited information about VBA. To do so, at first a “c” value should be assumed and then by checking if “the axial load calculated” for that “c” is equal to “the applied axial load”. Then a new “c” value, depending on three conditions I prepared, should be assumed and same procedure should be performed until “the axial load calculated” is equal to the “applied axial load”. My problem is that I couldn’t be able to update the axialload calculation using the new c value, so the do while condition does not change, so the loop does not stop until c is equal to the max value that can be defined using dim types. At the beginning I tried GoalSeek function but due to some error ,with code 1004 I think, it did not work. Then I prepared some iteration although it is not a good one. Does anybody know how to handle this kind of problem either using goal seek or iteration?

h=defined by user
c=h/2(initially should be different than zero to prevent division by zero error, so I assumed)
.
.
AxialLoad=calculated by some loops depending on “c”
.
.
c = c * 0.99(c should be decreased)
c = c * 1.01(c should be increased)
c = c * 1.01(c should be increased)
End If
Loop
.
.
.
.

### Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

Application.Calculate

should work.

If you bury your Axial Load calculation inside the Do While loop and run an exit command based on meeting certain criteria then the loop is performing the iteration for you.

Replies
4
Views
470
Replies
5
Views
134
Replies
9
Views
933
Replies
6
Views
221
Replies
3
Views
359

### Forum statistics

1,207,195
Messages
6,077,010
Members
446,250
Latest member
Dontcomehereoften

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back