Rearranging text data.
This small macro assumes the source data is on Sheet1 and the reorganized
data will be placed on Sheet2:
Sub ReOrganizer()
Dim s1 As Worksheet, s2 As Worksheet
Dim nRows As Long, nCols As Long, k As Long
Set s1 = Sheets("Sheet1")
Set s2 = Sheets("Sheet2")
s1.Activate
nRows = Cells(Rows.Count, "A").End(xlUp).Row
k = 1
For i = 1 To nRows
v1 = Cells(i, 1).Value
nCols = Cells(i, Columns.Count).End(xlToLeft).Column
For j = 2 To nCols
v2 = Cells(i, j).Value
s2.Cells(k, 1).Value = v1
s2.Cells(k, 2).Value = v2
k = k + 1
Next
Next
End Sub
--
Gary''s Student - gsnu200857
"Houston123" wrote:
I currently receive a file that has a list of client ID and each Client ID
contants a list of codes listed on the same row of the Client ID. I need to
have the codes modified so that they show up under a column instead on the
same row.
EX: the data comes to me in this format
Column
A D E
F G
JACK AA AB AC AD
JOEY AA AG AC AL
JAMES AD CD ED DE
I need the data to come out in this format:
JACK AA
JACK AB
JACK AC
JACK AD
JOEY AA
JOEY AG
JOEY AC
JOEY AL
Etc.
|