ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Insert a new row when the criteria is met in the cell above (https://www.excelbanter.com/excel-worksheet-functions/102514-insert-new-row-when-criteria-met-cell-above.html)

Firefighter1

Insert a new row when the criteria is met in the cell above
 
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)

Bob Phillips

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

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)

"Firefighter1" wrote in message
...
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)





All times are GMT +1. The time now is 10:05 PM.

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