Macro that takes words from a sentence and puts them in diff cells

A

andrei

I need a macro which takes every word from a sentence in a cell and puts it
in a different cell

Example :

A1 : Mother and father are gone on vacation

What i need is a macro which does this :

B1 : Mother
C1 : and
D1 : father
E1 : are
F1 : gone
G1 : on
H1 : vacation
 
M

Mike H

Hi,

Try this

Sub Sonic()
Dim V As Variant
Dim S As String
V = Split(Range("A1").Value, " ")
For x = 0 To UBound(V)
Cells(x + 1, 2) = V(x)
Next
End Sub
Mike
 
M

Mike H

My mistake you wanted it in columns not roes

Sub Sonic1()
Dim V As Variant
Dim S As String
V = Split(Range("A1").Value, " ")
For x = 0 To UBound(V)
Cells(1, x + 2) = V(x)
Next
End Sub

Mike
 
A

andrei

Thanks ! It works now !

Mike H said:
My mistake you wanted it in columns not roes

Sub Sonic1()
Dim V As Variant
Dim S As String
V = Split(Range("A1").Value, " ")
For x = 0 To UBound(V)
Cells(1, x + 2) = V(x)
Next
End Sub

Mike
 

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