výsledkem je nalezení nej-proměnných, které "hodí" nejlepší výsledek... jo a proměnných je tam jen 7, zatím.. spletl jsem se
sub analyza()
Dim dtab As Variant
Dim aaa%, bbb%, ccc%, ddd%, eee%, fff%, ggg%, sss%
Dim mez%
Dim predict1 As Double
Dim xproc As Double
azpo = Range("c987654").End(xlUp).Row
dtab = Range("a1:aw" & azpo)
mez = InputBox("mez= ")
Application.Calculation = xlCalculationManual
For aaa = 1 To 9
For bbb = 0 To 9
For ccc = 0 To 9
Application.StatusBar = aaa & bbb & ccc
For ddd = 0 To 9
For eee = 0 To 9
For fff = 0 To 9
For ggg = 0 To 9
sss = aaa + bbb + ccc + ddd + eee + fff + ggg
xplus = 0
xminus = 0
''' vypocty
For j = 7 To azpo Step 2
as1 = dtab(j, 45): as2 = dtab(j + 1, 45) 'aaa
at1 = dtab(j, 46): at2 = dtab(j + 1, 46) 'bbb
aq1 = dtab(j, 43): aq2 = dtab(j + 1, 43) 'ccc
ar1 = dtab(j, 44): ar2 = dtab(j + 1, 44) 'ddd
o1 = dtab(j, 15): o2 = dtab(j + 1, 15) 'eee
n1 = dtab(j, 14): n2 = dtab(j + 1, 14) 'fff
aw1 = dtab(j, 49): aw2 = dtab(j + 1, 49) 'ggg
predict1 = 0
predict1 = predict1 + as1 / (as1 + as2) * aaa / sss * 100
predict1 = predict1 + at1 / (at1 + at2) * bbb / sss * 100
predict1 = predict1 + aq1 / (aq1 + aq2) * ccc / sss * 100
predict1 = predict1 + ar1 / (ar1 + ar2) * ddd / sss * 100
predict1 = predict1 + (o1 + 16) / ((o1 + 16) + (o2 + 16)) * eee / sss * 100
predict1 = predict1 + (n1 + 1) / ((n1 + 1) + (n2 + 1)) * fff / sss * 100
predict1 = predict1 + (aw1 + 1) / (aw1 + aw2 + 2) * ggg / sss * 100
predict1 = predict1 - 2 * (dtab(j, 29) = dtab(j, 4))
predict1 = predict1 + 2 * (dtab(j, 29) = dtab(j + 1, 4))
xplus = xplus - (predict1 >= 55)
xminus = xminus - (predict1 < 45)
Next j
xproc = 100 * xplus / (xplus + xminus)
If sss > 0 Then
rozdil = xplus - xminus
If xproc >= mez then
radek = Range("ba100000").End(xlUp).Row + 1
Range("ba" & radek).Select
Range("ba" & radek) = aaa
Range("bb" & radek) = bbb
Range("bc" & radek) = ccc
Range("bd" & radek) = ddd
Range("be" & radek) = eee
Range("bf" & radek) = fff
Range("bg" & radek) = ggg
Range("bh" & radek) = sss
Range("bk" & radek) = xproc
Range("bl" & radek) = xplus - xminus
Range("bi" & radek) = xplus
Range("bj" & radek) = xminus
End If
End If
Next ggg
Next fff
Next eee
Next ddd
Next ccc
Next bbb
Next aaa
Application.StatusBar = False
Application.Calculation = xlCalculationAutomatic
End Sub
citovat