Hallo,
habe ein Modul und ein Value_Change. Code im Modul:
Sub test()
Dim table As Worksheet, x As Long, y As Long, lngZeilen As Long
Set table = Worksheets("Tabelle1")
lngZeilen = table.Cells(table.Rows.Count, 1).End(xlUp).Row
'Überprüfung der verfügbaren Frankreich + Italien + Sonstige Fahrzeuge
For y = 3 To lngZeilen
If table.Cells(y, 5) Like "Frankreich*" Or table.Cells(y, 5) Like "frankreich*" Then
Cells(y, 22) = 1
ElseIf table.Cells(y, 5) Like "Italien*" Or table.Cells(y, 5) Like "italien*" Then
Cells(y, 26) = 1
ElseIf table.Cells(y, 5) Like "Finnland*" Or table.Cells(y, 5) Like "Luxemburg*" Or table.Cells(y, 5) Like "Niederlande*" Then
Cells(y, 30) = 1
End If
Else
Cells(y, 22) = ""
Cells(y, 26) = ""
Cells(y, 30) = ""
End If
Next y
Nach jedem Eintrag eines bestimmten Werts in eine Zelle wird automatisch eine 1 in die entsprechende position gesetzt. Mein Problem ist jetzt, dass wenn man die Zelle manuell wieder löscht, die 1 nicht mit entfernt wird bzw. die Zelle nicht leer wird. Habe auch schon versucht (siehe Code Else-Anweisung)
Wo liegt der Fehler? In der Syntax??
Danke für eure Mühe!
Gruß Sino
|