Code Vereinfachung
10.02.2009 11:47:00
Björn
Für jede Verneinung steht x mit einem Wert. Für jede Bejahung steht x mit 0.
Das ganze lese ich in eine Datei ein aus der wiederum dann eine Listbox zur Anzeige befüllt wird
RW Abschlag FaktorAufschlag
Keine Metallic / Perleffekt oder Schwarzlackierung -3 0,5
.........
Da jedes x entweder Wahr oder Falsch sein kann, würden diverse Leerzeilen bei der Auslesung entstehen daher die Variable z. Ich kann die Dateil leider nicht hochladen, da zuviele sensible Daten da drinnen sind. Vielleicht kann mir ja doch jemand einen Ansatz geben wie ich den Nachstehenden Code in eine Schleife bekomme. Da es insgesamt um mehr als 20 Prüfungen geht hat man zum schluss 20 mal die z Variable.
If x 0 Then 'Metallic/Perleffekt/Schwarz
z = 1
Cells(204 + z, 11).FormulaR1C1 = "Keine Metallic / Perleffekt oder Schwarzlackierung"
Cells(204 + z, 12).FormulaR1C1 = x
Cells(204 + z, 13).FormulaR1C1 = y
Else
z = 0
End If
If x1 0 Then 'Radio
z1 = 1
Cells(204 + z + z1, 11).FormulaR1C1 = "Kein Radio"
Cells(204 + z + z1, 12).FormulaR1C1 = x1
Cells(204 + z + z1, 13).FormulaR1C1 = y1
Else
z1 = 0
End If
If x2 0 Then 'Telefon
z2 = 1
Cells(204 + z + z1 + z2, 11).FormulaR1C1 = "Kein Telefon oder Handy"
Cells(204 + z + z1 + z2, 12).FormulaR1C1 = x2
Cells(204 + z + z1 + z2, 13).FormulaR1C1 = y2
Else
z2 = 0
End If
If x3 0 Then 'weiß
z3 = 1
Cells(204 + z1 + z2 + z3 + z4, 11).FormulaR1C1 = "Weiße Lackierung"
Cells(204 + z1 + z2 + z3 + z4, 12).FormulaR1C1 = x3
Cells(204 + z1 + z2 + z3 + z4, 13).FormulaR1C1 = y3
Else
z3 = 0
End If
If x4 0 Then 'rot
z4 = 1
Cells(204 + z + z1 + z2 + z3 + z4, 11).FormulaR1C1 = "Rote Lackierung"
Cells(204 + z + z1 + z2 + z3 + z4, 12).FormulaR1C1 = x4
Cells(204 + z + z1 + z2 + z3 + z4, 13).FormulaR1C1 = y4
Else
z4 = 0
End If
If x5 0 Then 'Automatik
z5 = 1
Cells(204 + z + z1 + z2 + z3 + z4 + z5, 11).FormulaR1C1 = "Kein Automatik Getriebe"
Cells(204 + z + z1 + z2 + z3 + z4 + z5, 12).FormulaR1C1 = x5
Cells(204 + z + z1 + z2 + z3 + z4 + z5, 13).FormulaR1C1 = y5
Else
z5 = 0
End If
If x6 0 Then '3-türig
z6 = 1
Cells(204 + z + z1 + z2 + z3 + z4 + z5 + z6, 11).FormulaR1C1 = "Fahrzeug ist 3-türig"
Cells(204 + z + z1 + z2 + z3 + z4 + z5 + z6, 12).FormulaR1C1 = x6
Cells(204 + z + z1 + z2 + z3 + z4 + z5 + z6, 13).FormulaR1C1 = y6
Else
.........