Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default How to format cells to duplicate for every 5 rows.

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?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default How to format cells to duplicate for every 5 rows.

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




"Alicia" wrote:

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?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default How to format cells to duplicate for every 5 rows.

This worked perfectly.

Thanks!

"Joel" wrote:

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




"Alicia" wrote:

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?

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 can I find duplicate occurances of three cells in rows? TnT Tech Man Excel Worksheet Functions 2 February 6th 07 10:28 AM
Highliting Duplicate Cells across multiple rows equinekingdom Excel Worksheet Functions 4 April 14th 06 01:34 AM
merging cells and then deleting rows and duplicate entry [email protected] Excel Programming 3 April 30th 05 05:55 PM
Remove duplicate rows and sum cells ToddG[_4_] Excel Programming 7 September 27th 04 09:55 PM
How can I find Duplicate Cells or Rows pini35[_8_] Excel Programming 3 November 7th 03 09:10 AM


All times are GMT +1. The time now is 08:03 PM.

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"