Hi there,

I have an iteration which I want to use the principle of goal seek totally in vba without using the in-built excel one. Is this at all possible?

Code:
Sub Iterate()
Dim row As Integer
Dim i As Integer
Dim temp As Single
Dim flowCo As Single
Dim flowExp As Single
Dim PressCo As Single
Dim OJ As Single
Dim total As Single

Dim X As Single

R = 100

'3.441062516
Do Until total < 0.01 And total > 0
    'First need to calculate the O(J) Column
    row = Me.ListBox1.ListCount
    total = 0
    For i = 0 To row - 1
    temp = Me.ListBox1.List(i, 5)
    Me.ListBox1.List(i, 6) = R + temp
    
    'Now we calculate F(J)
    flowCo = Me.ListBox1.List(i, 2)
    flowExp = Me.ListBox1.List(i, 3)
    PressCo = Me.ListBox1.List(i, 4)
        
    OJ = Me.ListBox1.List(i, 6)
    Me.ListBox1.List(i, 7) = flowCo * ((Abs(OJ) ^ flowExp) * (OJ / Abs(OJ)))
    total = total + Me.ListBox1.List(i, 7)
    Next

If total < 0 Then
R = R + 0.1
Else
    If total > 1 Then
    R = R ^ 0.5
    ElseIf total > 0.1 Then
    R = R - 0.1
    ElseIf total > 0.01 Then
    R = R - 0.01
    End If 
End If


Loop

MsgBox R

'Now we need to sum it up



End Sub
I have tried all kinds of Tweaks and it does not seem to work

please help!