Welcome to the forum - please take a minute and look over the FAQs at the link in my sig
Try something like this
Option Explicit
Sub Macro1()
Dim ws As Worksheet
Dim cnt2021 As Long, cnt2022 As Long
Dim ary2021() As Long, ary2022() As Long
Dim rowLast As Long, i As Long
Set ws = Worksheets("A")
rowLast = ws.Cells(ws.Rows.Count, 3).End(xlUp).Row
For i = 1 To rowLast
If Left(ws.Cells(i, 3).Value, 4) = "2021" And ws.Cells(i + 1, 3) <> "Jan" Then
cnt2021 = cnt2021 + 1
ReDim Preserve ary2021(1 To cnt2021)
ary2021(cnt2021) = i
End If
Next i
For i = 1 To rowLast
If Right(ws.Cells(i, 6).Value, 4) = "2022" And ws.Cells(i + 1, 6) <> "Apr" Then
cnt2022 = cnt2022 + 1
ReDim Preserve ary2022(1 To cnt2022)
ary2022(cnt2022) = i
End If
Next i
i = 1
Do While Len(ws.Cells(i, 3).Value) = 0
ws.Rows(i).Hidden = True
i = i + 1
Loop
For i = 1 To UBound(ary2021)
ws.Rows(ary2021(i)).Resize(ary2022(i) - ary2021(i)).Hidden = True
' ws.Cells(ary2022(i), 6).ClearContents ' ??????????????
Next i
End Sub