View Single Post
  #11   Report Post  
Posted to microsoft.public.excel.programming
Tim Williams Tim Williams is offline
external usenet poster
 
Posts: 1,588
Default Can this can be done???

see edits in original message



--
Tim Williams
Palo Alto, CA


"DA@PD" wrote in message
...
Hi Tim,

It looks as if your script is short and effective, execpt I actually
simplified my example to make it easy to understand, there are actually 8
columns of descriptive data (like part number & description), and the

models
are actually in column P (the 9th column). What changes to your script

would
allow this to work? I thought it would be easy to modify the script to go

to
column p, but I don't understand VBA enough to accomplish this

modification.

Thanks!

David

"Tim Williams" wrote:

If your data is in sheet1 columns A-C and your reformatted data is to be
placed in sheet2

Sub reformat()

Dim r As Long, x As Integer
Dim arr As Variant
Dim s As Worksheet
Dim c As Range

r = 2
Set s = ThisWorkbook.Sheets("Sheet2")


With ThisWorkbook.Sheets("Sheet1")

'adjust range to suit
For Each c In .Range("A2:A2000")

arr = Split(c.Offset(0, 8).Value, ",")
For x = LBound(arr) To UBound(arr)
c.Resize(1, 8).Copy s.Cells(r, 1)
s.Cells(r, 9).Value = Trim(arr(x))
r = r + 1
Next x


Next c


End With
End Sub



--
Tim Williams
Palo Alto, CA


"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!