View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jacob Skaria Jacob Skaria is offline
external usenet poster
 
Posts: 8,520
Default text to column/row

With your data in Col A starting from row1; try the below macro which will
convert the data and write to ColB. Try and feedback

Sub Macro()

Dim lngARow As Long, lngBRow As Long
Dim strData As String
Dim arrData As Variant, intTemp As Integer

lngARow = 1
lngBRow = 1
Do While Range("A" & lngARow) < ""
arrData = Split(Range("A" & lngARow), ",")
Range("B" & lngBRow) = arrData(0)
lngBRow = lngBRow + 1
strData = Trim(Left(arrData(0), InStrRev(arrData(0), " ")))
For intTemp = 1 To UBound(arrData)
Range("B" & lngBRow) = strData & " " & Trim(arrData(intTemp))
lngBRow = lngBRow + 1
Next
lngARow = lngARow + 1
Loop

End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Daniel M" wrote:

I have some data i need to separate out. the data looks like this:

partnumber description location
1234 resistor R1, R3, R10

I need to be able to break the location out by comma. but i need to place it
in the next row under the first location. i think need to fill the rows under
it with the other data. ie: partnumber and description. it should look like
this:

1234 resistor R1
1234 resistor R3
1234 resistor R10

Can someone give me a hand with this? I know i can do text to column but it
may be 1 column or 100. Even if i can get this i still need to place the
value under the previous value. There will also be several lines so i need to
"INSERT" a row not just put it in the next row down! thanks.