View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones[_2_] Norman Jones[_2_] is offline
external usenet poster
 
Posts: 421
Default extracting strings from cell

Hi Arnand,

Try:

'================
Public Sub Tester2()
Dim arr As Variant
Dim i As Long
Const sStr As String = "AAA BBB CCC DDD"

arr = Split(sStr, Space(1))

For i = LBound(arr) To UBound(arr)
Debug.Print arr(i)
Next i

End Sub
'<<================


---
Regards.
Norman


"Anand" wrote in message
...
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.