Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

need to copy 5 rows for every part

Status
Not open for further replies.

atarrqis

IS-IT--Management
Nov 26, 2004
155
US
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.
 
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,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top