Mein Problem:
Der Bereich A2:A15 u. B4 soll lt. Liste (E1:E6) verglichen werden und die nicht vorhandenen Einträge im MsgBox ausgegeben werden.
MusterDatei:
https://www.herber.de/bbs/user/33824.xls
Hat vielleicht jemand ne Idee wie?
Grüsse Lorenz
Option Explicit
Sub tt()
Dim zeiA As Long, zeiE As Long, Satz As String
zeiA = Range("A65536").End(xlUp).Row
For zeiE = 1 To Range("E65536").End(xlUp).Row
If Application.WorksheetFunction.CountIf(Range("A1:A" & zeiA), Cells(zeiE, 5)) = 0 And InStr(Range("B4"), Cells(zeiE, 5)) = 0 Then
Satz = Satz & Cells(zeiE, 5) & Chr(10)
End If
Next zeiE
Satz = Left(Satz, Len(Satz) - 1)
If Len(Satz) > 0 Then MsgBox Satz
End Sub
Option Explicit
Sub tt()
Dim zeiE As Long, Satz As String, Bereiche, n As Integer, nn As Integer, vorh As Boolean
Bereiche = Array("A2:A5", "A9:A12", "B4")
For zeiE = 1 To Range("E65536").End(xlUp).Row
vorh = False
For n = 0 To UBound(Bereiche)
For nn = 1 To Range(Bereiche(n)).Cells.Count
If InStr(Range(Bereiche(n)).Cells(nn), Cells(zeiE, 5)) <> 0 Then
vorh = True
GoTo weiter
End If
Next nn
Next n
If vorh = False Then Satz = Satz & Cells(zeiE, 5) & Chr(10)
weiter:
Next zeiE
Satz = Left(Satz, Len(Satz) - 1)
If Len(Satz) > 0 Then MsgBox Satz
End Sub