Codeerweiterung klappt nicht
06.11.2008 13:50:00
Josef
Ich bekam heute dankenswerterweise folgenden Code, der auch bestens funktioniert:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim arrDaten
Dim raZelle As Range
If Intersect(Target, Columns("BF")) Is Nothing Then Exit Sub
Application.EnableEvents = False
arrDaten = Array(Array("J", "N", "J-xPV", "CHA/xPV", "EV-N / FV-XPV", "I-J/N"), Array("Ja", " _
Nein", "Ja", _
"eventuell", "eventuell", "eventuell"))
If Target.Count > 1 Then
If Not IsError(Application.Match(Selection.Cells(1), arrDaten(0), 0)) And Selection.Cells( _
_
1) "" Then Selection.Offset(0, 17) = arrDaten(1)(Application.Match(Selection.Cells(1), _
arrDaten(0), 0) - 1)
Else
If Not IsError(Application.Match(Target, arrDaten(0), 0)) And Target "" Then Target. _
Offset(0, 17) = arrDaten(1)(Application.Match(Target, arrDaten(0), 0) - 1)
End If
Application.EnableEvents = True
Jetzt wollte ich diesen Code um eine weitere abfrage erweitern jedoch bekomme ich keijn _
Ergebnis. Wo könnte ich hier bitte den Fehler gemacht haben?
Private Sub Worksheet_Change(ByVal Target As Range)
Dim arrDaten
Dim raZelle As Range
If Intersect(Target, Columns("BF")) Is Nothing Then Exit Sub
Application.EnableEvents = False
arrDaten = Array(Array("J", "N", "J-xPV", "CHA/xPV", "EV-N / FV-XPV", "I-J/N"), Array("Ja", " _
Nein", "Ja", _
"eventuell", "eventuell", "eventuell"))
If Target.Count > 1 Then
If Not IsError(Application.Match(Selection.Cells(1), arrDaten(0), 0)) And Selection.Cells( _
_
1) "" Then Selection.Offset(0, 17) = arrDaten(1)(Application.Match(Selection.Cells(1), _
arrDaten(0), 0) - 1)
Else
If Not IsError(Application.Match(Target, arrDaten(0), 0)) And Target "" Then Target. _
Offset(0, 17) = arrDaten(1)(Application.Match(Target, arrDaten(0), 0) - 1)
End If
Application.EnableEvents = True
Dim arrDaten1
Dim raZelle1 As Range
If Intersect(Target, Columns("BH")) Is Nothing Then Exit Sub
Application.EnableEvents = False
arrDaten1 = Array(Array("KOA 0", "KOA 20 %", "20% HB/HM"), Array("Kein Selbstbehalt", "20 % _
mind. 20 % der HBG", "20 % mind. 20 % der HBG"))
If Target.Count > 1 Then
If Not IsError(Application.Match(Selection.Cells(1), arrDaten1(0), 0)) And Selection. _
Cells( _
1) "" Then Selection.Offset(0, 16) = arrDaten1(1)(Application.Match(Selection.Cells(1), _
arrDaten1(0), 0) - 1)
Else
If Not IsError(Application.Match(Target, arrDaten1(0), 0)) And Target "" Then Target. _
_
Offset(0, 16) = arrDaten1(1)(Application.Match(Target, arrDaten1(0), 0) - 1)
End If
Application.EnableEvents = True
End Sub
Danke
Josef