Duplicating Multiple Cells & Columns

t5timesb

New Member
Joined
Dec 9, 2014
Messages
32
I am struggling with something and maybe it is the shear number of times I have to do this. So I have output I received from 30,888 cells (lets call them "finished goods" - below my finished good is: "FW15RH20.KBSTVS.GDRB60"). Now, I need to pair each of the "finished goods with 20 different items like shown below. Each "finished goods" cell is paired with 2 other columns (0,A).

This is an example of 1 "finished goods" paired with the columns, remember, I have 30,888 of these, HOW DO I DO THIS?

FW15RH20.KBSTVS.GDRB60

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

<colgroup><col><col></colgroup><tbody>
</tbody>
0A
FW15RH20.KBSTVS.GDRB60

<tbody>
</tbody>
1B
FW15RH20.KBSTVS.GDRB60

<tbody>
</tbody>
2C
FW15RH20.KBSTVS.GDRB60

<tbody>
</tbody>
3D
FW15RH20.KBSTVS.GDRB60

<tbody>
</tbody>
4E
FW15RH20.KBSTVS.GDRB60

<tbody>
</tbody>
5F
FW15RH20.KBSTVS.GDRB60

<tbody>
</tbody>
6G
FW15RH20.KBSTVS.GDRB60

<tbody>
</tbody>
7H
FW15RH20.KBSTVS.GDRB60

<tbody>
</tbody>
8I
FW15RH20.KBSTVS.GDRB60

<tbody>
</tbody>
9J
FW15RH20.KBSTVS.GDRB60

<tbody>
</tbody>
10K
FW15RH20.KBSTVS.GDRB60

<tbody>
</tbody>
11L
FW15RH20.KBSTVS.GDRB60

<tbody>
</tbody>
12M
FW15RH20.KBSTVS.GDRB60

<tbody>
</tbody>
13N
FW15RH20.KBSTVS.GDRB60

<tbody>
</tbody>
14O
FW15RH20.KBSTVS.GDRB60

<tbody>
</tbody>
15P
FW15RH20.KBSTVS.GDRB60

<tbody>
</tbody>
16Q
FW15RH20.KBSTVS.GDRB60

<tbody>
</tbody>
17R
FW15RH20.KBSTVS.GDRB60

<tbody>
</tbody>
18S
FW15RH20.KBSTVS.GDRB60

<tbody>
</tbody>
19T
FW15RH20.KBSTVS.GDRB60

<tbody>
</tbody>
20U

<tbody>
</tbody>
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
so you have 30,888 finished goods imported from elsewhere...
You then need 20 (or 21 (including the 0,A)?) rows for each of the finished goods? so in total 30,888*20 = 617760 Rows of data?
beside each finished good in column B you want the numbers 1-20 (0-20) in order, and in column C the letters A through U (B-U)? for all 617760 rows.

To a third party... no that didnt make much sense.
also, why the red letters?
 
Upvote 0
Ok. Let me try again. Right now, I have 30,888 rows in Column A. I have 20 rows in Column B. I have 20 rows in Column C.

I need Column A to duplicate itself for 20 times while Column B & C will stay the same. It seems like a simple process, but I need to do it 30,888 times.
 
Upvote 0
Ok. Let me try again. Right now, I have 30,888 rows in Column A. I have 20 rows in Column B. I have 20 rows in Column C.

I need Column A to duplicate itself for 20 times while Column B & C will stay the same. It seems like a simple process, but I need to do it 30,888 times.

I am happy to pay someone in golf clubs if that helps!
 
Upvote 0
So column A has unique finished goods, all 30,888 of them?
You then want something like this?

<tbody>
</tbody>
Finished Good1
0A
Finished Good11B
.........
Finished Good120U
Finished Good20A
Finished Good21B
.........
Finished Good220U

<tbody>
</tbody>

etc, so in total you have 617760 rows of Data?
 
Last edited:
Upvote 0
Does anyone know how to do this?
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 form 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 = "=INDIRECT(""Sheet1!A""&INT(ROW(R[20]C)/21))" 'this will be VERY SLOW
    Range("B1").FormulaR1C1 = "=MOD(ROW()+20,21)" 'this gets the numbers 0-20 in column B
    Range("C1").FormulaR1C1 = "=CHAR(RC[-1]+65)" '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
Yea, it took about 10-12 seconds to run the macro, but it works!
 
Upvote 0

Forum statistics

Threads
1,215,343
Messages
6,124,400
Members
449,156
Latest member
LSchleppi

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