Rearrange sheet data

C

C

I need some help to get my data rearranged in my sheet.


My spreadsheet contains Item Numbers and Customer Data. Column C to ?
contains Customer specific information..Location...etc..
Col A Col B Col C:?
Item # Customer Customer Specific information.
123 ABC Could be C:D or C:JJ
123 DEF
123 GHI
456 ABC
456 DEF

I would like to rearrange the data to the following columns:

Col A Col B
123
ABC Customer Specific info. C:?
DEF
GHI
456
ABC
DEF

One Item number could have 1 Customer or could have 1000 Customers.


I am not a VBAer, so any help would be appreciated.
 
D

Don Guillett

Option Explicit
Sub compiledataSAS() 'Assumes A HEADER ROW
Application.ScreenUpdating = False
Dim i As Long
For i = Cells(Rows.Count, 1).End(xlUp).Row To 2 Step -1
If Cells(i - 1, 1) = Cells(i, 1) Then
Cells(i, 2).Cut Cells(i, 1)
Else
Cells(i, 2).Cut
Cells(i + 1, 1).Insert shift:=xlDown
End If
Next i
Application.ScreenUpdating = True
End Sub
 
C

C

Hello Don,
This works perfect for Col A and B. But the data in Col C:? doesn't adjust
with Col B moving. The customer specific (Col C:?) would need to adjust to
the same row as the Col B data. Any ideas?
 
D

Don Guillett

If desired, send your file to my address below. I will only look if:
1. You send a copy of this message on an inserted sheet
2. You give me the newsgroup and the subject line
3. You send a clear explanation of what you want
4. You send before/after examples and expected results.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top