Solved excel: insert row when date in column changes

December 18, 2012 at 13:35:23
Specs: Windows XP

I have a spreadsheet with bank transactions and want to insert a blank row every time the date in column A changes. Can someone help me write a macro to do this? Thanks!

See More: excel: insert row when date in column changes

Report •


#1
December 18, 2012 at 14:15:19
✔ Best Answer

Hi Marvin

Here is something that might work although you should try it out on a copy of your workbook.

Sub AddRow()

        NoRows = Range("A" & Rows.Count).End(xlUp).Row

        For i = 2 To NoRows

                   If Cells(i, 1) <> Cells(i - 1, 1) And Cells(i, 1) <> "" And Cells(i - 1, 1) <> "" Then
                           Cells(i, 1).EntireRow.Insert
                           i = i + 1
                   End If
         Next

End Sub


Report •

#2
December 18, 2012 at 23:23:11

Thank you!

Report •

Related Solutions


Ask Question