Insert a new row when the criteria is met in the cell above

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have part numbers in a spreadsheet that may appear several times in a
column. I do a sort on these part numbers to get the same part numbers
together. I now need to insert a blank row between the different part
numbers. (As soon as the part numbers changes I need a blank row inserted)
 
For i = Cells(Rows.Count,"A").End(xlUp).Row To 2 Step -1
If Cells(i,"A").Value <> Cells(i-1, "A").Value Then
Rows(i).Insert
End If
Next i

--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)
 
Back
Top