LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default EXTRACTING SUBSTRINGS !!

HI Jay

Try this:

Sub aaa()
Dim A As String
Dim brkout() As String
Dim B As String, C As String, D As String, E As String, Leftover As
String
Const Delemiter As String = ", "

brkout = Split(A, "..")
B = brkout(1)
C = brkout(2)
D = brkout(3)
E = brkout(4)

If UBound(brkout) 4 Then
For x = 5 To UBound(brkout)
If Leftover = "" Then
Leftover = brkout(x)
Else
Leftover = Leftover & Delemiter & brkout(x)
End If
Next
End If
End Sub

Regards,
Per

On 8 Maj, 08:22, 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 Developersdexhttp://www.developersdex.com***


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Substituting substrings Constantly Amazed Excel Programming 3 May 1st 07 08:25 AM
Macro Help for Substrings [email protected] Excel Programming 4 May 17th 06 04:03 PM
sum wrt substrings! via135 Excel Worksheet Functions 6 March 26th 06 07:06 PM
Substrings in Excel? mzafar Excel Discussion (Misc queries) 3 February 28th 06 06:55 PM
STRINGS AND SUBSTRINGS ! jay dean Excel Programming 3 December 29th 04 06:22 AM


All times are GMT +1. The time now is 05:04 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"