Solved Insert row with change of value in col A in excel

September 15, 2017 at 12:22:04
Specs: Windows 7
I have a spreadsheet that in column a has an acct number and in column H has a service date. There can be one or many service dates for each acct. I just am trying to insert a blank row in between each acct number.
Can someone help me with a Macro Code?
I am using Office 16.
Thanks
Pam

See More: Insert row with change of value in col A in excel

Reply ↓  Report •

#1
September 15, 2017 at 12:30:10
✔ Best Answer
Sub InsertAcctRow()
'Determine Last Row with data in Column A
lastRw = Range("A" & Rows.Count).End(xlUp).Row
'Loop from Last Row to Row 2, Inserting a Row at each change in Column A
  For prvRw = lastRw To 2 Step -1
   If Range("A" & prvRw - 1) <> Range("A" & prvRw) Then
     Range("A" & prvRw).EntireRow.Insert
   End If
  Next
End Sub

How To Post Data or Code ---> Click Here Before Posting Data or VBA Code


Reply ↓  Report •
Related Solutions


Ask Question