PDA

View Full Version : [SOLVED:] Repeat 12 time the data on column A to column B



parscon
12-10-2013, 02:20 AM
I need a VBA code that can repeat the data on column A1 , 12 time on column B .


A1: 213
A2: 214
A3: 215


I need this result on Column B :

B1: 213
B2: 213
B3: 213
B4: 213
.
.
.
B12:213
B13:214
B14:214
B15:214
B16:214
.
.
.
B24:214
B25:215
B26:215
B27:215
B28:215
B29:215
B30:215
......


Thank you for your help

nilem
12-10-2013, 05:23 AM
Hi Parscon,
try this

Sub ertert()
Dim rng As Range: Set rng = Range("A1", Cells(Rows.Count, 1).End(xlUp))
With Range("B1").Resize(rng.Count * 12)
.FormulaR1C1 = "=INDEX(" & rng.Address(, , xlR1C1) & ",INT((ROW(RC[-1])-1)/12)+1)"
.Value = .Value
End With
End Sub

parscon
12-10-2013, 05:36 AM
Thank you very much for your help.