URGENT - Duplication Process

t5timesb

New Member
Joined
Dec 9, 2014
Messages
32
I need help with creating the following operation:

Finished Good 10A
Finished Good 11B
.........
Finished Good 120U
Finished Good 20A
Finished Good 21B
.........
Finished Good 220U
Finished Good 30,8880A
Finished Good 30,8881B
.........
Finished Good 30,88820U

<tbody>
</tbody>

Column A is duplicated and then changed to the next in order. Column B & C remain the same. Column B stays 1-20. Column C is the same for the 20 rows, but is not actual "A", "B"..."U".
 
That is what I want, yes, but I also want all 30,888 rows to be duplicated 20 times.

Basically at the end, I will have 617,760 rows.
 
Upvote 0

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Sub test()
Dim x As Integer
x = Application.InputBox("Number of Rows", "Number of Rows", Type:=1)
If x = False Then Exit Sub
ActiveCell.EntireRow.Copy
myRange = ActiveSheet.Columns(A)
Application.CutCopyMode = False
End Sub

I need it to copy each row in Column A, not just A1.
 
Upvote 0
If I could change the range above, I can fix it though.

Here is what you are asking for:
Sub FinishedGoods() 'with the sheet of imported data active... do the following Macro.
Application.ScreenUpdating = False
lastRow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row
FGRows = lastRow * 21
ActiveWorkbook.Worksheets.Add After:=Worksheets(Worksheets.Count)
ActiveSheet.Name = "Finished Goods" ' named Finished Goods
ActiveCell.FormulaR1C1 = “=INDEX(Sheet1!C,INT((Row()-ROW(R1C))/21)+1)”
Range("B1").FormulaR1C1 = "=MOD(ROW()+20,21)"
Range("C1").FormulaR1C1 = "=CHAR(RC[-1]+65)"
Range("A1:C1").AutoFill Destination:=Range("A1:C" & FGRows)
Range("A1:C" & FGRows).Copy
Range("A1").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Columns("A:A").EntireColumn.AutoFit
Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub
 
Upvote 0
Your code worked for me:

Code:
Sub FinishedGoods() 'with the sheet of imported data active... do the following Macro.
    Dim LastRow As Long
    Dim FGRows As Long
    Application.ScreenUpdating = False
    LastRow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row
    FGRows = LastRow * 21
    ActiveWorkbook.Worksheets.Add After:=Worksheets(Worksheets.Count)
    ActiveSheet.Name = "Finished Goods" ' named Finished Goods
    ActiveCell.FormulaR1C1 = "=INDEX(Sheet1!C,INT((Row()-ROW(R1C))/21)+1)"
    Range("B1").FormulaR1C1 = "=MOD(ROW()+20,21)"
    Range("C1").FormulaR1C1 = "=CHAR(RC[-1]+65)"
    Range("A1:C1").AutoFill Destination:=Range("A1:C" & FGRows)
    Range("A1:C" & FGRows).Copy
    Range("A1").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
    Columns("A:A").EntireColumn.AutoFit
    Application.CutCopyMode = False
    Application.ScreenUpdating = True
End Sub
 
Upvote 0
To confirm "it worked":

1) You have 617,760 lines?
2) Each "finished good" in column A is copied 20 times creating the 617,760 lines?

I tried again and in my first 10 lines on, I got (notice how the 60 goes to 61 to 62):

FW15RH20.KBSTVS.GDRB60
FW15RH20.KBSTVS.GDRB61
FW15RH20.KBSTVS.GDRB62
FW15RH20.KBSTVS.GDRB63
FW15RH20.KBSTVS.GDRB64
FW15RH20.KBSTVS.GDRB65
FW15RH20.KBSTVS.GDRB66
FW15RH20.KBSTVS.GDRB67
FW15RH20.KBSTVS.GDRB68
FW15RH20.KBSTVS.GDRB69
FW15RH20.KBSTVS.GDRB70

<colgroup><col></colgroup><tbody>
</tbody>

Is there a way you can send me your file?
 
Upvote 0
With your sample data from Post #5 I got 210 rows with each item repeated 21 times. Here are the first 22 rows:


Excel 2010
ABC
1FW15RH20.KBSTVS.GDRB600A
2FW15RH20.KBSTVS.GDRB601B
3FW15RH20.KBSTVS.GDRB602C
4FW15RH20.KBSTVS.GDRB603D
5FW15RH20.KBSTVS.GDRB604E
6FW15RH20.KBSTVS.GDRB605F
7FW15RH20.KBSTVS.GDRB606G
8FW15RH20.KBSTVS.GDRB607H
9FW15RH20.KBSTVS.GDRB608I
10FW15RH20.KBSTVS.GDRB609J
11FW15RH20.KBSTVS.GDRB6010K
12FW15RH20.KBSTVS.GDRB6011L
13FW15RH20.KBSTVS.GDRB6012M
14FW15RH20.KBSTVS.GDRB6013N
15FW15RH20.KBSTVS.GDRB6014O
16FW15RH20.KBSTVS.GDRB6015P
17FW15RH20.KBSTVS.GDRB6016Q
18FW15RH20.KBSTVS.GDRB6017R
19FW15RH20.KBSTVS.GDRB6018S
20FW15RH20.KBSTVS.GDRB6019T
21FW15RH20.KBSTVS.GDRB6020U
22FW15RH20.KBSTVS.GDBW600A
Finished Goods
 
Upvote 0
@t5timesb as per your request on the other thread...

Code:
Sub FinishedGoods()
    'with the sheet of imported data active... do the following Macro.
    Application.ScreenUpdating = False
    lastRow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row
    FGRows = lastRow * 21 'if the numbers go fromm 0-20 that's 21 numbers...
    ActiveWorkbook.Worksheets.Add After:=Worksheets(Worksheets.Count) 'I'll just put everything in a new worksheet
    ActiveSheet.Name = "Finished Goods" ' named Finished Goods
    ActiveCell.FormulaR1C1 = "=INDEX(Sheet1!C,INT((Row()-ROW(R1C))/21)+1)" 'this will be VERY SLOW
    Range("B1").FormulaR1C1 = "=MOD(ROW()+20,21)" 'this gets the numbers 0-20 in column B
    Range("C1").FormulaR1C1 = "=VLOOKUP(CHAR(RC[-1]+65),{""A"",""CUTOFF"";""B"",""SHAFT1"";""C"",""FERRULE"";""D"",""FERRULEFW15"";""E"",""GRIP"";""F"",""GRIP1"";""G"",""MATCHPOINT"";""H"",""CLUBHEAD"";""I"",""ASSEMBLY"";""J"",""GRINDFERRULES"";""K"",""LOFT/LIE"";""L"",""LASER"";""M"",""CLEAN"";""N"",""BAND"";""O"",""ISLABEL"";""P"",""PACK"";""Q"",""BXSET15"";""R"",""INCFREIGHT"";""S"",""DIRECTLA"";""T"",""VARIABLEOH"";""U"",""FIXEDOH""},2,TRUE)" 'this gets the letters A thru U in column C
    Range("A1:C1").AutoFill Destination:=Range("A1:C" & FGRows) 'because it's slow, I will paste over itself with just the values.
    Range("A1:C" & FGRows).Copy
    Range("A1").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
    Columns("A:A").EntireColumn.AutoFit
    Application.CutCopyMode = False
    Application.ScreenUpdating = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,217
Messages
6,123,670
Members
449,115
Latest member
punka6

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top