Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 14
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 14
Default 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
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
insert rows in a worksheet that do not change adjoining rows craigandmel Excel Discussion (Misc queries) 2 April 29th 08 10:26 PM
Insert rows: Formats & formulas extended to additonal rows Twishlist Excel Worksheet Functions 0 October 22nd 07 04:23 AM
How do I insert blank rows between rows in completed worksheet? bblue1978 Excel Discussion (Misc queries) 1 October 26th 06 07:02 PM
Count rows and insert number to count them. Mex Excel Discussion (Misc queries) 6 August 23rd 06 02:29 AM
How do i insert of spacer rows between rows in large spreadsheets laurel Excel Discussion (Misc queries) 0 April 24th 06 01:38 PM


All times are GMT +1. The time now is 02:32 AM.

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

About Us

"It's about Microsoft Excel"