Can anyone help with the code below. This code is exactly whay i am looking for and I will be able to adapt it and use it for my purposes if i can get it to go to D2,D3,D4 etc
Thanks
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range
Dim Dn As Range
Dim dt As Date
Dim fd As Boolean
Dim ws As Worksheet
If Target.Address(0, 0) = "D1" Then
Set rng = ActiveWorkbook.Names("Periods_PeriodNumber").RefersToRange
For Each Dn In rng
If CDate(Dn(, 2)) <= Range("D1") And CDate(Dn(, 3)) >= Range("D1") Then
Range("E1") = Dn
fd = True
Exit For
End If
Next Dn
If fd = False Then Range("E1") = "No Match Found"
End If
End Sub
Thanks
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range
Dim Dn As Range
Dim dt As Date
Dim fd As Boolean
Dim ws As Worksheet
If Target.Address(0, 0) = "D1" Then
Set rng = ActiveWorkbook.Names("Periods_PeriodNumber").RefersToRange
For Each Dn In rng
If CDate(Dn(, 2)) <= Range("D1") And CDate(Dn(, 3)) >= Range("D1") Then
Range("E1") = Dn
fd = True
Exit For
End If
Next Dn
If fd = False Then Range("E1") = "No Match Found"
End If
End Sub