How to duplicate or repeat data

pr103

New Member
Joined
Jul 21, 2011
Messages
16
I have a column: Name, Phone Number, Address (each in separate rows).

I'm trying to duplicate these three texts into one column
For example:

Name
Phone Number
Address
Name
Phone Number
Address....

and so on..

How can I achieve this in an easier way?
 
Code:
Sub list()
Dim e As Range, k As Long
For Each e In Range("A:C")
k = k + 1
Cells(k, 5) = e.Value
If (k Mod 3 = 0) * (e.End(4).Row = Rows.Count) Then Exit For
Next e
End Sub
 
Upvote 0

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
So change the destination in the code from "E" to "A".

Unless your current list is in columns A:C, in which case you'll have a helluva time trying to create your list no matter what you do. You best bet is to use an intermediate column, like E, and copy the revised list to A when you're done.

Now why don't you try to give this some effort yourself instead of just pointing out that it's not what you want.
 
Upvote 0
I'm not sure what you mean? The first item in the list, which is the name, does get transposed in the code. Do you mean you want the output result to look like this:

Name: Bob
xx
xx
Name: Tom

If so that'd be pretty easy to do.
 
Upvote 0
Never mind. It works perfectly.
How do I add categories to the list.
Like:

Name
Phone number
Address
State
Country
Zip code
 
Upvote 0
Sub foo()
Dim x As Long, y As Long
For x = 2 To Cells(Rows.Count, "A").End(xlUp).Row
For y = 1 To 3
Cells(x, y).Copy Cells(Rows.Count, "E").End(xlUp).Offset(1)
Next y
Next x
End Sub


Adjust the 3 in the Y = 1 to 3 to however many additions you have. With what you posted it should be Y = 1 to 6.
 
Upvote 0

Forum statistics

Threads
1,224,551
Messages
6,179,476
Members
452,915
Latest member
hannnahheileen

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