View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
John Bundy John Bundy is offline
external usenet poster
 
Posts: 772
Default extracting strings from cell

If it always has a space, look into the split function, it splits data at a
delimiter into an array, if you don't like that then just step through each
character in a for next loop
*pseudocode*

For i=1 to len(cells(1,1))
myString=myString & trim(mid(cells(1,1),i,1))

if mid(cells(1,1),i,1)="" then
Names(arrayIndex)=mystring
mystring=Nothing
arrayIndex=arrayIndex+1
end if

next

that looks like it should do what you ask.


--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"Anand" wrote:

I have multiple names stored in a cell. I want to extract individual
names out of the cell. Appreciate any help in this regard.

The cell contains "AAA BBB CCC DDD"
I want to extract this into an array:
Names(0) = "AAA"
Names(1) = "BBB"
Names(2) = "CCC"
Names(3) = "DDD"

Thanks,
Anand.