Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
how do i count and insert rows
I have Names begining with the letter C (c1205, c4356, c8609) i need 6 rows
between every name, the data i import dosent always follow this rule so i need to insert the number of missing rows and also add a 0 to the rows i insert. |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
how do i count and insert rows
Hi,
I don't understand the second part of the question and possibly not even the first part but this small macro inserts 6 rows between each value in column A. Change MC to your column Sub Insert_Rows() mc = "A" For i = Cells(Rows.Count, mc).End(xlUp).Row To 2 Step -1 Rows(i).Resize(6).Insert Next i End Sub Mike "calvin" wrote: I have Names begining with the letter C (c1205, c4356, c8609) i need 6 rows between every name, the data i import dosent always follow this rule so i need to insert the number of missing rows and also add a 0 to the rows i insert. |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
how do i count and insert rows
calvin;344314 Wrote: I have Names begining with the letter C (c1205, c4356, c8609) i need 6 rows between every name, the data i import dosent always follow this rule so i need to insert the number of missing rows and also add a 0 to the rows i insert.I would need some dummy data/workbook to workout the counting missing rows, however this code will insert 6 rows for each instance and add zero. Code: -------------------- Sub Insert_6_rows_add_0() Dim i As Long For i = Range("A" & Rows.Count).End(xlUp).Row To 7 Step -1 Rows(i & ":" & i - 5).EntireRow.Insert Range("A" & i & ":A" & i - 5).Value = 0 Next i End Sub -------------------- -- Simon Lloyd Regards, Simon Lloyd 'The Code Cage' (http://www.thecodecage.com) ------------------------------------------------------------------------ Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1 View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=96336 |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
how do i count and insert rows
Not quite what i am looking for lets try it again
my data is as follows Ctu25 (names) 18 15 23 24 16 18 Ctu26 (names) 22 21 20 15 17 ctu32(names) 21 24 32 32 21 13 i need to count the rows between the names if it is 6 rows do nothing if not add the missing rows and a zero as a place holder 6 rows between every name the data sometimes give me 3 or 5 "Simon Lloyd" wrote: calvin;344314 Wrote: I have Names begining with the letter C (c1205, c4356, c8609) i need 6 rows between every name, the data i import dosent always follow this rule so i need to insert the number of missing rows and also add a 0 to the rows i insert.I would need some dummy data/workbook to workout the counting missing rows, however this code will insert 6 rows for each instance and add zero. Code: -------------------- Sub Insert_6_rows_add_0() Dim i As Long For i = Range("A" & Rows.Count).End(xlUp).Row To 7 Step -1 Rows(i & ":" & i - 5).EntireRow.Insert Range("A" & i & ":A" & i - 5).Value = 0 Next i End Sub -------------------- -- Simon Lloyd Regards, Simon Lloyd 'The Code Cage' (http://www.thecodecage.com) ------------------------------------------------------------------------ Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1 View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=96336 |
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) | |||
Insert rows: Formats & formulas extended to additonal rows | Excel Worksheet Functions | |||
How do I insert blank rows between rows in completed worksheet? | Excel Discussion (Misc queries) | |||
Count rows and insert number to count them. | Excel Discussion (Misc queries) | |||
How do i insert of spacer rows between rows in large spreadsheets | Excel Discussion (Misc queries) |