Ich möchte nach Datensätzen suchen lassen, die zellinhalte in bestimmter Reihenfolge enthalten:
Danke
Sub SuchABCD()
Dim Anz%, LR#, Sp%, Z#
Sp = 3 'Spalte C
LR = ActiveSheet.Cells(Rows.Count, Sp).End(xlUp).Row 'letzte Zeile der Spalte
For Z = 2 To LR
If Cells(Z, Sp) = "A" And Cells(Z + 1, Sp) = "B" And _
Cells(Z + 2, Sp) = "C" And Cells(Z + 3, Sp) = "D" Then
With Range(Cells(Z, Sp), Cells(Z + 3, Sp))
With .Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With .Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With .Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With .Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
End With
Z = Z + 4
End If
Next
End Sub
| ||||||||||||||||||||||||||||||||||||||||||||||||||||