AW: aktive Zelle mit Spalte F vergleichen
09.07.2009 11:07:56
Tino
Hallo,
müsste so funktionieren.
Sub A()
Dim BereichF As Range
Dim varRow
Dim Bereich As Range, rInfo As Range
With Application
.ScreenUpdating = False
.EnableEvents = False
'Suchbereich
Set Bereich = Range("A1", Cells(Rows.Count, 1).End(xlUp).Offset(0, 4))
With Sheets("Tabelle2") 'Deine Liste (Spalte F) Tabellenname anpassen
Set BereichF = .Range("F1", .Cells(.Rows.Count, 6).End(xlUp))
End With
For Each Bereich In Bereich
If Bereich.Column >= Selection(1).Column Then
If Not Bereich.Column = Selection(1).Column Or Bereich.Row >= Selection(1).Row Then
varRow = Application.Match(Bereich, BereichF, 0)
If IsNumeric(varRow) Then
If BereichF(varRow, 1).Interior.ColorIndex = 15 Then
Bereich.Value = ""
If rInfo Is Nothing Then
Set rInfo = Bereich
Else
Set rInfo = Union(Bereich, rInfo)
End If
End If
End If
End If
End If
Next Bereich
.ScreenUpdating = True
.EnableEvents = True
End With
If rInfo Is Nothing Then
MsgBox "Es wurde nichts gefunden!", vbInformation
Else
MsgBox "Es wurden die Zelle(n)" & vbCr & rInfo.Address(0, 0) & vbCr & "gelöscht", vbInformation
End If
End Sub
Gruß Tino