INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • 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

Jobs from Indeed

need to copy 5 rows for every part

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.

Please answer each of these questions.

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,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

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.

Reply To This Thread

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

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

Resources

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:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close