ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Separating Strings (https://www.excelbanter.com/excel-programming/341732-separating-strings.html)

asmenut

Separating Strings
 
I have a String (actually a few of them) that are combined with a "/"
separator (i.e. String1 / String2 / String3). How would I go about reading
the string and separating the individual strings from them like:

String1
String2
String3

Thanks in advance

galimi[_2_]

Separating Strings
 
You can cycle through the code using INSTR to find the segments containing
slashes.
--
http://HelpExcel.com
1-888-INGENIO
1-888-464-3646
x0197758


"asmenut" wrote:

I have a String (actually a few of them) that are combined with a "/"
separator (i.e. String1 / String2 / String3). How would I go about reading
the string and separating the individual strings from them like:

String1
String2
String3

Thanks in advance


David McRitchie

Separating Strings
 
Your question is unclear, normally when asked to separate a string
it goes onto the same row. But since you are placing the results
in three rows the example becomes very ambiguous.

Is it just a Column that exists and is going to generate
2 additional rows or will the number of substrings vary. Is it only
once cell that you are going to start with. When you program something
you have to have things clearly defined before starting (well at least
you're supposed to in theory), because the program is going to do
exactly what you ask it to do (even if you don't know what you told it to do)..
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"asmenut" wrote in message ...
I have a String (actually a few of them) that are combined with a "/"
separator (i.e. String1 / String2 / String3). How would I go about reading
the string and separating the individual strings from them like:

String1
String2
String3

Thanks in advance




Tom Ogilvy

Separating Strings
 
v = split(sStr,"\")
for i = lbound(v) to ubound(v)
msgbox v(i)
next

--
Regards,
Tom Ogilvy

"asmenut" wrote in message
...
I have a String (actually a few of them) that are combined with a "/"
separator (i.e. String1 / String2 / String3). How would I go about

reading
the string and separating the individual strings from them like:

String1
String2
String3

Thanks in advance




asmenut

Separating Strings
 
Thanks guys (especially Tom)

Finally found that function in the appendix of J. Walkenbachs book

"Tom Ogilvy" wrote:

v = split(sStr,"\")
for i = lbound(v) to ubound(v)
msgbox v(i)
next

--
Regards,
Tom Ogilvy

"asmenut" wrote in message
...
I have a String (actually a few of them) that are combined with a "/"
separator (i.e. String1 / String2 / String3). How would I go about

reading
the string and separating the individual strings from them like:

String1
String2
String3

Thanks in advance






All times are GMT +1. The time now is 05:20 PM.

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