Extract items in text, place them in another column

L

Lane Smith

Can I extract each item in a single cell and place each in column B
with a macro
Example
A1=apple
column b
a
p
p
l
e
Thanks in advance
 
R

Rick Rothstein

Your question is not clearly stated. Did you want the split-out letters to
be placed in a single cell with each letter on a separate line or did you
want the split-out letters to go in multiple cells, on letter per cell? See
if you can make use of either of these solutions...

Single cell solution
-------------------------------------------------
Sub SplitWithinOneCell()
Dim Txt As String
Txt = StrConv(Range("A1").Value, vbUnicode)
Range("B1").Value = Replace(Left(Txt, Len(Txt) - 1), Chr(0), vbLf)
End Sub

Multiple cell solution
--------------------------------------------------
Sub SplitToMultipleCells()
Dim Txt As String
Txt = StrConv(Range("A1").Value, vbUnicode)
Range("B1").Resize(Len(Range("A1").Value)) = WorksheetFunction. _
Transpose(Split(Left(Txt, Len(Txt) - 1), Chr(0)))
End Sub

Rick Rothstein (MVP - Excel)




"Lane Smith" wrote in message

Can I extract each item in a single cell and place each in column B
with a macro
Example
A1=apple
column b
a
p
p
l
e
Thanks in advance
 

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

Top