Search code examples
vbaexcelsubtotal

add row after each subtotal excel vba


I need a macro that will insert a row after each subtotal, please see picture below for desired result.

Added rows highlighted


Solution

  • For i = 1000 to 1 Step -1 ' adjust 1000 to the row number of the last element
        If Cells(i,1).Font.Bold And Cells(i,1) <> "" then
            Cells(i+1,1).EntireRow.Insert
        End If
    Next