Can this can be done???
Something like this will do it:
Sub MakeList()
Dim LR As Long
Dim i As Long
Dim n As Long
Dim x As Long
Dim lCount As Long
Dim coll As Collection
Dim arr1
Dim arr2
Dim arr3
LR = Cells(1).End(xlDown).Row
arr1 = Range(Cells(2, 1), Cells(LR, 3))
Set coll = New Collection
For i = 1 To UBound(arr1)
arr2 = Split(arr1(i, 3), ",")
lCount = lCount + UBound(arr2) + 1
coll.Add arr2
Next
ReDim arr3(1 To lCount, 1 To 3)
For i = 1 To coll.Count
For n = 0 To UBound(coll(i))
x = x + 1
arr3(x, 1) = arr1(i, 1)
arr3(x, 2) = arr1(i, 2)
arr3(x, 3) = Trim(coll(i)(n))
Next
Next
Sheets(2).Activate
Range(Cells(2, 1), Cells(lCount + 1, 3)) = arr3
End Sub
RBS
"DA@PD" wrote in message
...
Hi Experts!
I have been working on an inventory project where I am trying to match
parts
to the model of car they fit. I had built a spreadsheet in the following
format:
Part # Description Model
7V4325 Bolt Cabrio, Golf, GTI, Jetta
9G3263 Gasket Barretta, Cavalier, Corsica
Of course after I'm sent out to compile a huge list of about 1,000 lines
of
parts, and compile litterally thousands of models the parts fit. The IS
department tells me I have to put the lists in the following format:
7V4325 Bolt Cabrio
7V4325 Bolt Golf
7V4325 Bolt GTI
7V4325 Bolt Jetta
9G3263 Gasket Barretta
9G3263 Gasket Cavalier
9G3263 Gasket Corsica
As you can see, this could become quite frustrating, as it took me a month
to build the list, and could take me another two weeks to seperate out
each
row for some of the parts which fit over 20 vehicles. Is it possible to
write a script or something that could tranform the data that is in the
upper
format to the lower format?
Any help would be GREATLY APPRECIATED!
|