View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
tlavedas tlavedas is offline
external usenet poster
 
Posts: 3
Default Extracting Data out of a string

ranswrt wrote:
I need to write a code that extracts out of a string the city, state and zip.
An example of a string is:

Las Vegas, Nv 89103

I need to an array variable to separate out the city, state and zip separatly.
Thanks


Try this ...

sExample = " Las Vegas, Nv 89103 "
aAddress = Split(Trim(sExample), ",")
sTemp = aAddress(0) & "," _
& Replace(Replace(Trim(aAddress(1)), " ", " "), " ", ",")
aAddress = Split(sTemp, ",")

Tom Lavedas
===========