![]() |
How to add 3 rows with every change?
Try the sub below on a spare copy of your file ..
(sub taken from a post in .programming, modified to suit your col P, data assumed running in P2 down) Sub InsertRow_At_Change() Dim i As Long With Application .Calculation = xlManual .ScreenUpdating = False End With For i = Cells(Rows.Count, 16).End(xlUp).Row To 3 Step -1 If Cells(i - 1, 16) < Cells(i, 16) Then _ Cells(i, 1).Resize(3, 1).EntireRow.Insert Next i With Application .Calculation = xlAutomatic .ScreenUpdating = True End With End Sub -- Max Singapore http://savefile.com/projects/236895 xdemechanik --- "graydon" wrote: Hi I have a database where there are only 2 types of information on each row within the 'P' column ('PE' and 'IP') I was wondering if somebody might show me how I could add 3 rows eachtime the next level changes (i.e from IP to PE) and (PE to IP) the blocks of continuity vary, there could be 30 IP's then 2 PE's and then 7 IP's etc. I just need 3 added rows each time they change from one to the other Thanks G |
How to add 3 rows with every change?
Glad it worked fine for you.
Thanks for feeding back. -- Max Singapore http://savefile.com/projects/236895 xdemechanik --- "graydon" wrote: Thanks Max that worked great and saved so much time G |
All times are GMT +1. The time now is 12:43 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com