Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4
Default How to add 3 rows with every change?

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
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4
Default How to add 3 rows with every change?

Thanks Max that worked great and saved so much time
G

"Max" wrote:

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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to add 3 rows with every change? Max Excel Worksheet Functions 1 March 28th 07 02:12 AM
Change Columns to Rows Diane Walker Excel Discussion (Misc queries) 2 January 31st 07 04:07 PM
Change the rows to the columns Nikki Excel Discussion (Misc queries) 2 August 6th 06 09:58 PM
How do change rows to colums AND columns to rows Colleen A Excel Discussion (Misc queries) 7 December 30th 05 12:40 AM
excel deleting rows last cell does not change. How to change? mrubey Excel Discussion (Misc queries) 3 August 25th 05 08:38 PM


All times are GMT +1. The time now is 11:31 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"