ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Fastest way to store each word in a cell in a diff variable (https://www.excelbanter.com/excel-programming/394100-fastest-way-store-each-word-cell-diff-variable.html)

J@Y

Fastest way to store each word in a cell in a diff variable
 
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)

RB Smissaert

Fastest way to store each word in a cell in a diff variable
 
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


"J@Y" wrote in message
...
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)




All times are GMT +1. The time now is 07:34 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com