ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Insert a row after each account no change (https://www.excelbanter.com/excel-programming/291561-insert-row-after-each-account-no-change.html)

Janmy

Insert a row after each account no change
 
How to set the macro for insert a row automatically after each account no ?

Tom Ogilvy

Insert a row after each account no change
 
Sub Accounts()
Dim rng As Range, i As Long
Set rng = Cells(Rows.Count, 1).End(xlUp)
For i = rng.Row To 1 Step -1
If Cells(i + 1, 1).Value < Cells(i, 1).Value Then
Cells(i + 1, 1).EntireRow.Insert
End If
Next

End Sub

--
Regards,
Tom Ogilvy



"Janmy" wrote in message
...
How to set the macro for insert a row automatically after each account no

?



Janmy

Insert a row after each account no change
 
Thank you very much!


All times are GMT +1. The time now is 10:39 AM.

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