Hello
I have the following sheet (see attachment) And I like to iterate an cell (D6) till (D21+I10=N15) or result will converge (equilibrium reached).
A.
Hello
I have the following sheet (see attachment) And I like to iterate an cell (D6) till (D21+I10=N15) or result will converge (equilibrium reached).
A.
Are you looking for a formula to figure out this number? Or are you looking for VBA to count D6 up by a certain number until the condition is met.
Have you tried Goal Seek?
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
I think you just want to use Goal Seek.
Make sure you have the Solver Add In installed. If you want it to be part of a macro, just record it.
morning
It is possible to be solved without solver.xla? VBA?
I put this solution:
[VBA]
Option Explicit
Private Sub Worksheet_Calculate()
Application.EnableEvents = False
Range("N14").Formula = "=2*PI()*(N13-N12)/(LN(((N4+2*N5)/2000)/(N4/2000))/N9+LN(((N4+2*N6)/2000)/(N4/2000))/N10+LN(((N4+2*N6+2*N7)/2000)/((N4+2*N6)/2000))/N11)"
Range("D22").Formula = "=PI()*D21*((D4+2*D5)/1000)*D6*(D7-D8)"
Range("I10").Formula = "=I4*(I8^4-I9^4)*I7*I5"
Range("N14").Name = "conductivity"
Range("D22").Name = "convection"
Range("I10").Name = "radiation"
Range("G19").Formula = "=conductivity-(convection+radiation)"
On Error GoTo TheEnd
Range("G19").GoalSeek Goal:=0, ChangingCell:=Range("D7")
TheEnd:
Application.EnableEvents = True
End Sub
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Excel.Range)
Worksheet_Calculate
End Sub
[/VBA]
What do you think?
I like to add extra conditions:
[VBA]
if (range("D4").value + 2* range("D5").value)/1000 <= 0.075 then
Range("G10").Formula = "=I4*(I8^4-I9^4)*I7*I5*D6"
else ..etc
[/VBA]
my problem is how to add condition in if statement?
"if (range("D4").value + 2* range("D5").value)/1000 <= 0.075 then"
Looks ok to me.