Hallo und ein spezielles hallo an Reinhard,
Ich hab ein Problem an dem ich mir die Zähne ausbeise. Ich habe die Werte hart reingeschrieben, möchte aber die Werte variabel gestalten und aus einer anderen Tabelle holen und vergleichen. Die vielen Variablen und das Weiter den nächsten Vergleichswert holen sind die Probleme, wie bringe ich die unter einen Hut?
Grüße Wolfgang
_
Mein „theoretischer“ Aufbau:
y = 2
Do While Range(„A“ & y) „“
If Cells(y, 5).Value Like „AA“
‘ „AA“ = Range(“A1”)
And Cells(y, 6).Value = „16“
‘ „16“ = Range(“A2”)
And
if Cells(y, 27).Value Like „0“
Then nothing
if Cells(y, 27).Value Like „1“
Then Range(„N“ & y).Select
ActiveCell.FormulaR1C1 = „=RC[-1]-14“
if Cells(y, 27).Value Like „2“
Then Range(„L“ & y).Select
ActiveCell.FormulaR1C1 = „=RC[-1]-28“
if Cells(y, 27).Value Like „3“
Then Range(„M“ & y).Select
ActiveCell.FormulaR1C1 = „=RC[-1]-42“
Endif
Endif
Endif
Endif
ElseIf Cells(y, 5).Value Like „AA“ And Cells(y, 6).Value = „17“
‘ „AA“ = Range(“A1”)
‘ „17“ = Range(“A3”)weiter A1 mit A4 bis A1 A Ende__ AEnde = Wert X
And if Cells(y, 27).Value Like „0“
Then nothing
if Cells(y, 27).Value Like „1“
Then Range(„N“ & y).Select
ActiveCell.FormulaR1C1 = „=RC[-1]-14“
if Cells(y, 27).Value Like „2“
Then Range(„L“ & y).Select
ActiveCell.FormulaR1C1 = „=RC[-1]-28“
if Cells(y, 27).Value Like „3“
Then Range(„M“ & y).Select
ActiveCell.FormulaR1C1 = „=RC[-1]-42“
Endif
Endif
Endif
Endif
End If
y = y + 1
Loop
So sollte es sein:
y = 2
Do While sheets(“NL_14”). Range(„A“ & y) „“
If sheets(“NL_14”).Cells(y, 5).Value Like sheets(“14”).range(“A1”)
‘ A1 weiter B1 bis ?1 ?1 Wert = X
And sheets(“NL_14”).Cells(y, 6).Value = sheets(“14”).range(“A2”)
‘ A2 weiter A3 bis A? A? Wert = X
And
if sheets(“14”). Cells(y, 27).Value Like „0“
Then nix
if sheets(“14”). Cells(y, 27).Value Like „1“
Then sheets(“NL_14”).Range(„N“ & y).Select
ActiveCell.FormulaR1C1 = „=RC[-1]-14“
if sheets(“14”).Cells(y, 27).Value Like „2“
Then sheets(“NL_14”).Range(„L“ & y).Select
ActiveCell.FormulaR1C1 = „=RC[-1]-28“
if sheets(“14”). Cells(y, 27).Value Like „3“
Then sheets(“NL_14”).Range(„M“ & y).Select
ActiveCell.FormulaR1C1 = „=RC[-1]-42“
Endif
Endif
Endif
Endif
ElseIf ………………………………
End If
y = y + 1
Loop
Tabelle 14
__ A B C D ……………………………. AA AB AC AD……………….
1__AA BB CC DD X AA BB CC DD X
2__16 26 36 46 1 1 2 2
3__17 27 37 47 1 0 1 2
4__X 28 38 48 _ 1 3 1
5_____29 X 49 _ 3 _ 1
6_____X_____X
Tabelle NL_14
__ A B C D E F
1__123 B C D AA 16
2__222 B C D BB 66
3__565 B C D AA 17
