I need to locate all cells within column L starting from Row 10 containing yyyymm+2 (202009). In other words, I'm looking for cells containing all dates belonging to the month 2 months in advance of the current month. Valid values would be 20200901 up until 20200930 accordingly as of July 2020.
The Column L contains values in text format such as 20201120, 20210102, etc. All the values are dates in Column L formatted as text as 'yyyymmdd'.
I'm trying to use the code below, but it is quite clearly wrong, since +2 won't show the correct year or month if the year changes.
Dim strSearchText As String
Dim y As Integer
Dim m As Integer
m = DatePart("mm", Date) + 2
y = DatePart("yyyy", Date)
strSearchText = y & m
Dim rngSearchArea As Range
Set rngSearchArea = ws.Range(Range("L10"), ws.Range("L" & ws.Range("L:L").Cells.Count).End(xlUp))
Any ideas how to solve this?
=Day(L2)what does it return? - FaneDuru=Day(L11). - FaneDuru