INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

#### Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs from Indeed

# need to copy 5 rows for every part

 Forum Search FAQs Links MVPs

## need to copy 5 rows for every part

(OP)
Excel 2010, I have 5 rows of data on one sheet with the first column = part. On the second sheet I have a list of parts - 101, 102, 103.
I need to copy the 5 rows with part = 101, then copy the 5 rows again with part = 102, etc.

### RE: need to copy 5 rows for every part

Hi,

Why?

What's the purpose?

Can you state the business case for this requirement?

Maybe an uploaded workbook would help understand what you need and why.

Assuming you have headings in row 1 in both tables...

#### CODE

Dim r As Range, rng As Range, lRow as Long, i As Integer

Set rng = Sheet2.Cells(2, 1)
Set rng = Sheet2.Ranger(rng, rng.End(xlDown))

lRow = 2
For Each r in rng
For i = 1 to 5
Sheet1.Cells(lRow, 1).value = r.value
lRow = lRow + 1
NEXT
Next 

Skip,

Just traded in my OLD subtlety...
for a NUance!

### RE: need to copy 5 rows for every part

#### Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

#### Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

#### Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

# Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!