Hallo Liebe Programmierer,
Seit Stunden versuche ich mein Problem zu lösen. Bitte hilft mir doch weiter!! Also ich hab ca 16 Textboxen den ich eine Faktor zugewiesen habe. In der untersten Textbox soll die Summe der Textboxen als Dezimahlzahl stehen.
Ich hab alles versucht sei es cdbl addition oder textbox1.value+.... addition. leider stimmt die summe ganz unten nicht. in meiner ersten textbox wird der wert als prozent eingegeben. der wiederum ändert die faktoren der textboxen als auch ihre summe.
Sub addieren()
Dim a, b, c, d, e, f, g, h, i, j, k, l, m, n, o As Double
For Z = 2 To 11
If Start.TextBox1.Value <> "" Then
wert = Start.TextBox1.Value / 100
Start.Controls("TextBox" & Z).Value = (Tabelle1.Cells(Z, 1) * wert)
w = Start.Controls("TextBox" & Z).Value
End If
Next Z
Start.TextBox40.Value = wert * 2500
For y = 12 To 15
If Start.TextBox1.Value <> "" Then
wert = Start.TextBox1.Value / 100
Start.Controls("TextBox" & y).Value = (Tabelle1.Cells(y, 1) * wert)
w = Start.Controls("TextBox" & y).Value
End If
Next y
a = Start.TextBox2.Value
b = Start.TextBox3.Value
c = Start.TextBox4.Value
d = Start.TextBox5.Value
e = Start.TextBox6.Value
f = Start.TextBox7.Value
g = Start.TextBox8.Value
h = Start.TextBox9.Value
i = Start.TextBox10.Value
j = Start.TextBox11.Value
k = Start.TextBox12.Value
l = Start.TextBox13.Value
m = Start.TextBox14.Value
n = Start.TextBox15.Value
o = a + b + c + d + e + f + g + h + i + j + k + l + m + n
Start.TextBox16.Value = o
o = Val(Start.TextBox2.Value) + Val(Start.TextBox3.Value) + Val( _
Start.TextBox4.Value) + Val(Start.TextBox5.Value) + Val(Start.TextBox6.Value) _
+ Val(Start.TextBox7.Value) + Val(Start.TextBox8.Value) + Val( _
Start.TextBox9.Value) + Val(Start.TextBox10.Value) + Val( _
Start.TextBox11.Value) + Val(Start.TextBox12.Value) + Val( _
Start.TextBox13.Value) + Val(Start.TextBox14.Value) + Val( _
Start.TextBox15.Value)
'o = CDbl(a) + CDbl(b) + CDbl(c) + CDbl(d) + CDbl(e) + CDbl(f) + CDbl(g) +
' CDbl(h) + CDbl(i) + CDbl(j) + CDbl(k) + CDbl(l) + CDbl(m) + CDbl(n)
Start.TextBox16.Value = o
End Sub |