Excel – Repeating a list of cells in excel X number of times

microsoft excelvba

I have a list of names in excel,

For example

Lizzy
William
Kate
Charles

I would like to use some VBA code (or other method to repeat this 12 times).

I will be doing this over and over again and sometimes my list of names may include less or more.

Has anyone got any direction for me as I am really stuck.

The output I would like in this specific case is,

Lizzy
William
Kate
Charles
Lizzy
William
Kate
Charles
Lizzy
William
Kate
Charles
Lizzy
William
Kate
Charles
Lizzy
William
Kate
Charles
Lizzy
William
Kate
Charles
Lizzy
William
Kate
Charles
Lizzy
William
Kate
Charles
Lizzy
William
Kate
Charles
Lizzy
William
Kate
Charles
Lizzy
William
Kate
Charles
Lizzy
William
Kate
Charles

What I have tried:

I have found a method using formulas, see, https://www.excel-bytes.com/how-to-repeat-a-range-of-items-multiple-times-in-excel/

However the problem with this is the indexing the initial list as my list will change.
Link to question put on hold: Copy and paste a list of names in excel 12 times

This question was originally asked by another user and put on hold so
I couldn't answer. I have a solution so I have reasked the question
and I will provide an answer and tag the original asker.

Best Answer

With data in column A, in B1 enter:

=IF(ROW()>COUNTA(A:A)*12,"",INDEX(A:A,MOD(ROW()-1,COUNTA(A:A))+1))

and copy downwards:

enter image description here

Column B will automatically adjust if column A changes.

Related Question