Home |
Search |
Today's Posts |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
As a side note, it doesn't have to be the same number of characters to use
the left, right, and mid functions, but you would have to do a bit more coding to find the location of the "_". The "instr" command will give you the position of the "_" character. "Brian K. Sheperd" wrote in message ... Is it always going to be the same number of characters? You could use the left$, mid$, and right$ functions. varstring = "xxxx_yy_zzzzzz" varx = left$(varstring,4) vary = mid$(varstring,6,2) varz = right$(varstring,6) Or you can use the split command. This will split the string based on a delimiter and store the values in an array. vararray = split(varstring, "_") Brian "Ahsan" wrote in message ... I have a string "xxxx_yy_zzzzzz". I would like to store "xxxx" as a string in a variable, "yy" as a string in another variable, and "zzzzzz" as a string in another variable. Is there code in visual basic for excel that would help me achieve this? Thanks Ahsan |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Selecting right part of text string | Excel Worksheet Functions | |||
Delete part of a text string | Excel Worksheet Functions | |||
Extract part of a text string | Excel Worksheet Functions | |||
Omitting right part of text string | Excel Worksheet Functions | |||
How do I extract part of a text string | Excel Discussion (Misc queries) |