Paste each cell 12 times

ivazu

New Member
Joined
May 13, 2019
Messages
1
Hi

I have list of accounts and I need each account to be pasted 12 times.

So I need to transform Column A into Column B. I have 1600 accounts so I was really hoping not to do this manually :))


MJ775fq
MJ775fq.png
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Hi & welcome to MrExcel.
How about
Code:
Sub ivazu()
   Dim Cl As Range
   
   For Each Cl In Range("A1", Range("A" & Rows.Count).End(xlUp))
      Cl.Copy Range("B" & Rows.Count).End(xlUp).Offset(1).Resize(1 * 12)
   Next Cl
End Sub
 
Upvote 0
Or if you wanted a formula, you could try in B1 copied down - for example:

=INDEX($A$1:$A$1600,1+INT((ROWS(B$1:B1)-1)/12))
 
Upvote 0
Hi, an alternative since i had written it.

Code:
Dim sh As Worksheet, lr As Double, arr, arr2, i As Double, j As Double, a As Double

Set sh = Sheets("Sheet1")
With sh
    lr = .Range("A" & .Rows.Count).End(xlUp).Row
    arr = .Range("A1:A" & lr)
    ReDim arr2(1 To lr * 12)
    .Columns("B").ClearContents
    For i = 1 To lr
        For j = 1 To 12
            arr2(j + a) = arr(i, 1)
        Next
        a = a + 12
    Next
    .Range("B1").Resize(UBound(arr2)) = Application.Transpose(arr2)
End With
 
Upvote 0
Cross posted https://www.excelforum.com/excel-formulas-and-functions/1275819-how-to-paste-each-cell-12-times.html

While we do not prohibit Cross-Posting on this site, we do ask that you please mention you are doing so and provide links in each of the threads pointing to the other thread (see rule 13 here along with the explanation: Forum Rules).
This way, other members can see what has already been done in regards to a question, and do not waste time working on a question that may already be answered.
 
Upvote 0

Forum statistics

Threads
1,213,552
Messages
6,114,278
Members
448,559
Latest member
MrPJ_Harper

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