Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy some information from sheet1 to sheet2
I have the following information on the sheet1
Products Color Quantity Bike Blue 3 Chair Yellow 2 Table Brown 4 ..... What I want is to copy above information to the sheet2 according to the number of quantity. In above example, the sheet2 should contain the infor as; Products Color Quantity Bike Blue 3 Bike Blue 3 Bike Blue 3 Chair Yellow 2 Chair Yellow 2 Table Brown 4 Table Brown 4 Table Brown 4 Table Brown 4 ..... Could someone help me out. Thanks J |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy some information from sheet1 to sheet2
Sub CopyData()
Dim iLastRow As Long Dim i As Long, j As Long, k As Long With Worksheets("Sheet1") iLastRow = .Cells(.Rows.Count, "A").End(xlUp).Row .Range("A1:C1").Copy Destination:=Worksheets("Sheet2").Range("A1") For i = 2 To iLastRow For k = 1 To .Cells(i, 3).Value j = j + 1 .Cells(i, "A").Resize(1, 3).Copy Destination:= _ Worksheets("Sheet2").Cells(j, "A") Next k Next i End With End Sub -- HTH RP (remove nothere from the email address if mailing direct) "john_liu" wrote in message ... I have the following information on the sheet1 Products Color Quantity Bike Blue 3 Chair Yellow 2 Table Brown 4 .... What I want is to copy above information to the sheet2 according to the number of quantity. In above example, the sheet2 should contain the infor as; Products Color Quantity Bike Blue 3 Bike Blue 3 Bike Blue 3 Chair Yellow 2 Chair Yellow 2 Table Brown 4 Table Brown 4 Table Brown 4 Table Brown 4 .... Could someone help me out. Thanks J |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
copy data from sheet2 to sheet1 when sheet2 has variable # of rows | Excel Discussion (Misc queries) | |||
how do copy "sheet1!A1+1 in sheet2 to sheet 3 and get "sheet2!A1+ | Excel Discussion (Misc queries) | |||
Copy result from sheet1 to sheet2 | Excel Discussion (Misc queries) | |||
Copy values from Sheet1 to Sheet2 | Excel Discussion (Misc queries) | |||
Copy values only, sheet1 to sheet2 without Selection | Excel Programming |