splitting one column into rows depending on the data in the column

  • Thread starter Thread starter ravinder.ingu
  • Start date Start date
R

ravinder.ingu

i have some text data in a single column in the following manner
there is a condition number and some data say d1 d2 d3 d4 ..
d100etc..followed by it(data is also numeric).. the condiotion numbers
are in ascending order..and may vary from 1 to 200..
i want the data to be in different columns( the column number being
the condition number)
and the entris in the column should be the data items (d1 d2 d3...)
 
Something along these lines- assumes condition & data is separated by a blank.

Dim cell As Range, row As Long, col As Integer, data as string
For Each cell In Range("a1:a100") '<== change to your requirements
col = CInt(Left(cell, InStr(1, cell, " ") - 1))
data = Right(cell, Len(cell) - InStr(1, cell, " "))
Cells(row, col) = data ' <=== Set row ?
Next

HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top