(14.06.2017, 19:22)cysu11 schrieb: Hallo Atilla,
selbstverständlich habe ich auch dein Vorschlag getestet mit dem gleichen Ergebniss, aber siehe selbst! :)
[
Dateiupload bitte im Forum! So geht es: Klick mich!
]
Vielen Dank
VG
Alexandra
Hallo Alexander,
und, was soll jetzt nicht funktioniern?
Ich habe die Datei von Dir runtergeladen mit meinem Code darin und es funktioniert alles.
Einzig beim Leeren der Zelle A18 werden die anderen Zellen nicht geleert.
Das kann man noch mit reinnehmen und dann sieht das Ganze so aus:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim x
Dim namensBereich As Range
Set namensBereich = Tabelle4.Range("A2:A3")
If Target(1).Address(0, 0) = "A18" Then
On Error GoTo fehler
Application.EnableEvents = False
Range("A19:A22") = ""
Range("A27") = ""
If Target(1) <> "" Then
x = Application.Match(Target, namensBereich, 0)
If IsNumeric(x) Then
With Tabelle4
Cells(19, 1) = .Cells(x + 1, 2)
Cells(20, 1) = .Cells(x + 1, 3)
Cells(22, 1) = .Cells(x + 1, 4) & " " & .Cells(x + 1, 5)
Cells(27, 1) = .Cells(x + 1, 5)
End With
Else
Target = ""
MsgBox "Dieser Name existiert nicht in der Namensliste!"
End If
End If
End If
fehler:
Application.EnableEvents = True
If Err Then MsgBox "Fehler: " & Err.Number & vbLf & vbLf & Err.Description
End Sub
Ich arbeite statt mit Target.Cells(1) mit Target(1).
Gruß Atilla