View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Jacob Skaria Jacob Skaria is offline
external usenet poster
 
Posts: 8,520
Default EXTRACTING SUBSTRINGS !!

Try this..

Dim strA As String
Dim strB As String
Dim strC As String
Dim strD As String
Dim strE As String
Dim arrTemp As Variant

arrTemp = Split("1..2..3..4..5..6..7..", "..")
strA = arrTemp(0)
strB = arrTemp(1)
strC = arrTemp(2)
strD = arrTemp(3)

For intTemp = 4 To UBound(arrTemp)
'If you dont want to store delimiter remove that...
strE = strE & arrTemp(intTemp) & ".."
Next

--
If this post helps click Yes
---------------
Jacob Skaria


"jay dean" wrote:


Hello -

Dim A as string
Dim brkout() as string
Dim B as string, C as string, D as string, E as string, Leftover as
string

A contains text. I am trying to store the first 4 substrings of A in B,
C, D, and E. Then I want whatever else is left to be stored in Leftover.
The delimiter for the substrings is ".."

I have been able to use the SPLIT() function to store the first 4
strings using brkout=split(A,"..")
then B=brkout(1):C=brkout(2):D=brkout(3):E =brkout(4)

How do I store the remaining text left in brkout() (apart from B,C,D and
E) in Leftover?

Any help would be appreciated.

Jay


*** Sent via Developersdex http://www.developersdex.com ***