Hello,

I have a spreadsheet that has a number of columns containing different values and data. The rows are sorted by month, which is displayed column C. Is there a way to have a VBA which loops through the rows and finds the last time each month was written, and then inserts a new blank row underneath it. I have some code below which inserts a new row after every month of January but only want it to insert a row after the last January, so that the months are separated in a block.

Thank you in advance!

Sub InsertAfterLastRow()
    Dim Rng As Range
    Set Rng = Range("C1:C100")
    Dim LastRow As Long
    Dim InsertRow As Long
    Dim Inserted As Boolean
    Dim NewRow As Range
 
    
    Inserted = False

    For Each Row In Rng.Rows
        If Inserted = False Then
            If Row.Cells(1, 1).Value = "January" Then
            
                    Rows(Row.Row + 1).Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
                    Set NewRow = Rows(rowNumber + 1 & ":" & rowNumber + 1)
                    NewRow.Cells(1, 1).Value = " "
                    Inserted = True
        
            End If
        Else
            Inserted = False
        End If
    Next
End Sub