Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
insert rows after data change in column
I have a wooksheet with numbers in column a and after the last same number i
want to insert 6 rows 1 1 1 2 2 3 3 3 4 4 5 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 any help mayer |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
insert rows after data change in column
Try something like
Sub AAA() Dim SaveVal As Long Dim R As Range Dim StartRow As Long StartRow = 1 Set R = Cells(StartRow, "A") SaveVal = R.Value Do Until R.Value = vbNullString If R.Value < SaveVal Then SaveVal = R.Value R.Resize(6, 1).EntireRow.Insert End If Set R = R(2, 1) Loop End Sub Cordially, Chip Pearson Microsoft Most Valuable Professional Excel Product Group, 1998 - 2009 Pearson Software Consulting, LLC www.cpearson.com (email on web site) On Sun, 9 Aug 2009 13:18:01 -0700, mayer wrote: I have a wooksheet with numbers in column a and after the last same number i want to insert 6 rows 1 1 1 2 2 3 3 3 4 4 5 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 any help mayer |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
insert rows after data change in column
If I understand your request properly, this should do it.
Sub insert6rowsaftersamelastnumber() Dim i As Long Dim mc As Long mc = 1 ' col a For i = Cells(Rows.Count, mc).End(xlUp).Row To 2 Step -1 If Cells(i - 1, mc) = Cells(i, mc) Then Rows(i + 1).Resize(6).Insert Exit For End If Next i End Sub -- Don Guillett Microsoft MVP Excel SalesAid Software "mayer" wrote in message ... I have a wooksheet with numbers in column a and after the last same number i want to insert 6 rows 1 1 1 2 2 3 3 3 4 4 5 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 any help mayer |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
insert rows in a worksheet that do not change adjoining rows | Excel Discussion (Misc queries) | |||
Function to insert rows on a change in a cell | Excel Discussion (Misc queries) | |||
insert rows programmatically with formula change | Excel Programming | |||
How to insert rows based on change in data | Excel Worksheet Functions | |||
macro to Insert rows at every change in a column | Excel Programming |