ich suche eine Möglichkeit zu prüfen, ob ein Datum-Wert in der SpalteA=Anfangdatum und der SpalteB=Enddatum vorhanden ist. Falls ja soll ein bestimmter Wert in Zeile SpalteD eingetragen werden.
Besten Dank für eure Hilfe.
Gruss
Peter
Sub test3a()
Dim daSuch As Date, raFund As Range
With Worksheets("Tabelle1")
daSuch = .Cells(1, 7)
Set raFund = .Columns("A:B").Find(what:=daSuch, LookIn:=xlValues, lookat:=xlWhole)
If Not raFund Is Nothing Then
.Cells(raFund.Row, 4) = .Cells(1, 10)
Else
MsgBox "Wert in Bereich nicht enthalten."
End If
End With
Set raFund = Nothing
End Sub
Gruß WernerSub test3a()
Dim daSuch As Date, raFund As Range
With Worksheets("Tabelle1")
daSuch = .Cells(1, 7)
Set raFund = .Columns("A:B").Find(what:=daSuch, LookIn:=xlValues, lookat:=xlWhole)
If Not raFund Is Nothing Then
.Cells(raFund.Row, 4).Resize(.Cells(.Rows.Count, 1).End(xlUp).Row - raFund.Row + 1) = _
.Cells(1, 10)
Else
MsgBox "Wert in Bereich nicht enthalten."
End If
End With
Set raFund = Nothing
End Sub
Gruß WernerSub Datumwert_finden_und_Wert_SpalteD_einfügen2()
Dim dDatum As Date, lZeile As Long, i As Long
Application.ScreenUpdating = False
With Worksheets("Tabelle2")
lZeile = .Cells(.Rows.Count, 1).End(xlUp).Row
dDatum = .Cells(1, 13)
For i = 2 To lZeile
If dDatum >= .Cells(i, 2) Then
If dDatum
Gruß Werner