Rearranging data

jbyrne

Board Regular
Joined
Feb 22, 2002
Messages
178
Hi,

I have file numbers in column A and phone numbers in column B

I need a macro that looks at the file number and if it sees a duplicate file number below it to put the phone number across instead of down.

In my example, I need c5 cell to have (555)555-5555 and d5 to have (666-6666 etc.

When completed there should only be one file number per row with phone numbers going across instead of down.

Any help would be appreciated.
Jim
Book1
ABCD
1FILENUMBERPHONENUMBER
2372982(111)111-1111
3123547(222)222-2222
4237426(333)333-3333
5273822(444)444-4444
6273822(555)555-5555
7273822(666)666-6666
8273822(777)777-7777
9565634(888)888-8888
10987652(999)999-9999
Sheet1
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
How about:

Sub macro()
[a2].Select
Do Until ActiveCell.Text = ""
If ActiveCell.Text = ActiveCell.Offset(1, 0).Text Then
ActiveCell.Offset(1, 1).Copy Destination:=Range("iv" & ActiveCell.Row).End(xlToLeft).Offset(0, 1)
ActiveCell.Offset(1, 0).EntireRow.Delete
Else
ActiveCell.Offset(1, 0).Select
End If
Loop
End Sub
 
Upvote 0
Thanks for the reply tact- it did remove the matching file numbers but did not put the additional phone numbers relating to the matching file number to the right of the 1st file number.
 
Upvote 0
I take that back...

Tact,

I spoke to soon- thanks I see the data to the right-

works great! thanks for your help
 
Upvote 0

Forum statistics

Threads
1,214,643
Messages
6,120,702
Members
448,980
Latest member
CarlosWin

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