dear guys...
i have a code but it runs so slowly
i would it to make it fast...can u help me??

what should i do???

Var2 = 0.1
        For y = 0 To jlhPro - 1
            Do
                Var1 = Var2

                For z = 0 To thn - 1
                    kata &= data(y, z) & "*" & Var1 & "^" & z + 1 & vbCrLf
                    Res1 += data(y, z) * Var1 ^ (z + 1)
                    kata &= "data = " & data(y, z) & vbCrLf
                    kata &= "res1 = " & Res1 & vbCrLf
                Next
                Res1 -= invest
                kata &= "res1 = " & Res1 & vbCrLf & vbCrLf & vbCrLf
                kata &= "=========================================" & vbCrLf


                For z = thn To 1 Step -1
                    Res2 += z * data(y, z - 1) * Var1 ^ (z - 1) & vbCrLf
                    kata &= z & "*" & data(y, z - 1) & "*" & Var1 & "^" & (z - 1) & vbCrLf
                    kata &= "res2 = " & Res2 & vbCrLf
                Next

                Var2 = Var1 - Res1 / Res2
            Loop Until Math.Abs(Var1 - Var2) < 0.00000001

            ir = (1 - Var2) / Var2
            kata &= "irr = " & ir * 100 & "% " & vbCrLf
        Next
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.