SanjayGMusafir
Well-known Member
- Joined
- Sep 7, 2018
- Messages
- 1,503
- Office Version
- 2021
- Platform
- MacOS
Hi Experts
Recently, I got help from @kevin9999 in the following post
Once I got things working, I thought exploring options and adding more conditions to it.
Now I realized that instead of jumping to closest date for example in my case - rather than jumping to 20Nov (today-30) it jumps to 25 Sep (today-90)
I must have ignored something simple and unable to identify it.
Please help
Thanks a lot
The code I'm using right now is -
Recently, I got help from @kevin9999 in the following post
VBA to Go to Today in a filtered range
Hi Experts I use following code to jump to today in a filtered range. It works well when table is sorted by date first and then by any other field. But challenge arises when table is sorted first by any other field and then by date. In such cases present date(s) can be around 1000+ rows...
www.mrexcel.com
Once I got things working, I thought exploring options and adding more conditions to it.
Now I realized that instead of jumping to closest date for example in my case - rather than jumping to 20Nov (today-30) it jumps to 25 Sep (today-90)
I must have ignored something simple and unable to identify it.
Please help
Thanks a lot
The code I'm using right now is -
VBA Code:
Dim x As Range
For Each x In Worksheets("Bank").Range("C2", Cells(Rows.Count, "C").End(xlUp))
If x >= Date And x <= Date + 365 And x.EntireRow.Hidden = False Then
x.Select
Exit For
ElseIf x >= Date - 30 And x <= Date And x.EntireRow.Hidden = False Then
x.Select
Exit For
ElseIf x >= Date - 60 And x <= Date - 30 And x.EntireRow.Hidden = False Then
x.Select
Exit For
ElseIf x >= Date - 90 And x <= Date - 60 And x.EntireRow.Hidden = False Then
x.Select
Exit For
End If
Next x