View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Stefan
 
Posts: n/a
Default Transposition impossibility?

With a random number of lines being reported for the sizes for the
product codes, I can't figure out a way to run a copypaste
specialtranspose macro because doing it manually sucks.


It would be best if the sizes went into different columns so I could
run further analysis but any ideas gratefully accepted.


Rob,

you can run this code

Sub transform()
Set b = Worksheets("Sheet1") '< change name if needed
iRow = Application.CountA(Columns(1))
xRow = 1
xCol = 5
For i = 2 To iRow
If Cells(i, 1) < Cells(i - 1, 1) Then
xRow = xRow + 1: xCol = 5
Cells(xRow, 4) = Cells(i, 1)
End If
Cells(xRow, xCol) = Cells(i, 2)
xCol = xCol + 1
Next
End Sub


This is if your list is in column A:B and starts from the top.
The result comes in column D: ...

--
Stefan