ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Break string into words (https://www.excelbanter.com/excel-programming/289515-break-string-into-words.html)

Tommy T

Break string into words
 
Hey guys,
I'm looking to extract some info from textboxes on a
userform. The info could be 1-4 words. Is there a way I
can break a string of 4 words into 4 separate strings? I
know with Excel functions I could use Search to find the
spaces and then try to go from there, but is there a
better way?

Thanks,
TT

Steve Yandl[_3_]

Break string into words
 
The VB "split" function will return a one dimensional array of substrings
and the default delimter is the space character. You can then check the
size of the array and deal with the substrings however you wish.

Steve


"Tommy T" wrote in message
...
Hey guys,
I'm looking to extract some info from textboxes on a
userform. The info could be 1-4 words. Is there a way I
can break a string of 4 words into 4 separate strings? I
know with Excel functions I could use Search to find the
spaces and then try to go from there, but is there a
better way?

Thanks,
TT




Tommy T

Break string into words
 
Thanks, that's exactly what I was looking for.
-----Original Message-----
The VB "split" function will return a one dimensional

array of substrings
and the default delimter is the space character. You

can then check the
size of the array and deal with the substrings however

you wish.

Steve


"Tommy T" wrote in

message
...
Hey guys,
I'm looking to extract some info from textboxes on a
userform. The info could be 1-4 words. Is there a

way I
can break a string of 4 words into 4 separate

strings? I
know with Excel functions I could use Search to find

the
spaces and then try to go from there, but is there a
better way?

Thanks,
TT



.



All times are GMT +1. The time now is 12:00 PM.

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