Hi all,
I have a worksheet which is logging finances (incoming/outgoing) on the relevant dates, not every date is available if not used.
Currently I have a code which works for a specific date, it moves me to the cell with today's date. Is it possible to go to a 'nearest' date instead as this would be more suitable and more dynamic for the worksheet.
Any help with this would be appreciated, please find the current code I am using below:
I have a worksheet which is logging finances (incoming/outgoing) on the relevant dates, not every date is available if not used.
Currently I have a code which works for a specific date, it moves me to the cell with today's date. Is it possible to go to a 'nearest' date instead as this would be more suitable and more dynamic for the worksheet.
Any help with this would be appreciated, please find the current code I am using below:
Code:
Sub Find_First()
Dim FindString As String
Dim Rng As Range
With Sheets("Current")
FindString = .Range("F1")
If Trim(FindString) <> "" Then
With .Range("F3:F2000")
Set Rng = .Find(What:=CDate(FindString), _
After:=.Cells(1), _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not Rng Is Nothing Then
Application.Goto Rng, True
Else
MsgBox "Nothing Found"
End If
End With
End If
End With
End Sub