How to format cells to duplicate for every 5 rows.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am working on a sheet that already has ID numbers in column a. in the
format listed below. This goes on for about 300 rows

47846
47847

How can I format the sheet to look like this:
47846
47846
47846
47846
47846
47840
47840
47840
47840
47840
I need to list information in column b and c that corresponds to column a.
However, column a must contain the corresponding id number. Is there a way I
can automate this instead of doing it manually?
 
The macro below copies each row 4 times to give a total of 5 rows with each
id. Wasn't sure if you wanted entire row copies



Sub insert4rows()

LastRow = Cells(Rows.Count, "A").End(xlUp).Row
For RowCount = LastRow To 1 Step -1
Rows(RowCount).Copy
Rows(RowCount & ":" & (RowCount + 3)).Insert Shift:=xlDown
Next RowCount
End Sub
 
This worked perfectly.

Thanks!

Joel said:
The macro below copies each row 4 times to give a total of 5 rows with each
id. Wasn't sure if you wanted entire row copies



Sub insert4rows()

LastRow = Cells(Rows.Count, "A").End(xlUp).Row
For RowCount = LastRow To 1 Step -1
Rows(RowCount).Copy
Rows(RowCount & ":" & (RowCount + 3)).Insert Shift:=xlDown
Next RowCount
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top