Insert Blank Row with data match change

  • Thread starter Thread starter Mitche
  • Start date Start date
M

Mitche

I'm trying to figure out a way to evenly space data. Where I don't have a
repeat value in the row directly below the current one I want to insert a
blank row. Some of my data series looks like this.

Column A Column B

Part Number Description
(Cell A2): AC011000 (Cell B2) FUEL TANK, CARTRIDGE ADAPTOR
(Cell A3: AC011000 (Cell B3) FUEL TANK, CARTRIDGE ADAPTOR
BLANK ROW
(Cell A5) AC011001 (Cell B5) XX55 Assy, Li-80 Adaptor
BLANK ROW
AC051000 KIT, XX25 MANUALS
AC051000 KIT, XX25 MANUALS
BLANK ROW

I want a blank row to be inserted below Row 5 because the part number is not
repeated.
Can anyone help?
 
Not quite sure of your layout but try this

Sub insertrowifnondup()
Dim mc As Long
Dim i As Long
mc = 1 'col a
For i = Cells(Rows.Count, mc) _
.End(xlUp).Row To 2 Step -1
If Len(Application.Trim(Cells(i, mc))) > 0 And _
Application.CountIf(Columns(mc), _
Cells(i, mc)) < 2 Then Rows(i + 1).Insert
Next i
End Sub
 
Back
Top