ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Insert Blank Row with data match change (https://www.excelbanter.com/excel-discussion-misc-queries/252900-insert-blank-row-data-match-change.html)

Mitche

Insert Blank Row with data match change
 
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?

Don Guillett

Insert Blank Row with data match change
 
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

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Mitche" wrote in message
...
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?




All times are GMT +1. The time now is 09:55 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com