Fastest way to store each word in a cell in a diff variable

J

J@Y

If I have a cell with words in them separated by spaces, what is the
fastest/easiest way to store each word into a variable? (Non Text-to-Column
way)
 
R

RB Smissaert

Try something like this:

Sub test()

Dim i As Long
Dim str As String
Dim arr

str = Cells(1).Text

arr = Split(str, " ")

For i = 0 To UBound(arr)
Cells(i + 1, 2) = arr(i)
Next i

End Sub


RBS
 

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