der u.st. Code findet Zellinhalte, welche vor dem aktuellem Datum liegen. Nun fängt er aber am entferntesten Tag vom aktuellem Datum an zu finden. Kann mir jemand die Suchrichtung ändern?
Besten Dank für die Hilfe.
Gruß
Karsten
Option Explicit
Public xrng As Range
Public xrngBereich As Range
Sub finde_Inhalt_in_B_bis_heute()
Dim varRes
Dim varResult0
Application.EnableEvents = False
With ActiveSheet
If xrng Is Nothing Then
varRes = Application.Match(CLng(Date), .Range("A:A"), 0)
If IsNumeric(varRes) Then
Set xrngBereich = .Range(Cells(2, 2), .Cells(varRes, 2))
Set xrng = xrngBereich.Find(What:=.Cells(1, 2), LookIn:=xlValues, LookAt:=xlPart, After: _
=xrngBereich.Cells(xrngBereich.Rows.Count, 1))
If Not xrng Is Nothing Then Application.GoTo xrng
End If
Else
Set xrng = xrngBereich.FindNext(xrng)
If Not xrng Is Nothing Then Application.GoTo xrng
End If
End With
Selection.WrapText = True
Application.Run "Einfaerben_rot"
Application.EnableEvents = True
End Sub