Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
RG III wrote:
My input string is a set of numbers that represent prices. Each price is separated by one or more spaces AND/OR tabs. For example: s = " 1200 300 25 2 4 10000 " There might also be tabs separating numbers, such as: s = " 1200[tab]300 25 2 4[tab][tab]1000 " where [tab] is the location of an actual tab. Assuming that my data will always have the following format, what is a good way to extract each numerical value into a variant or array? I'm thinking the Split() function will help, but I'm kind of thrown off because the separators could be spaces AND/OR tabs. Something like this? (Untested air code.) Dim s1 As String, s2 As String, s3 As Variant s1 = Trim(Replace(s, vbTab, " ")) Do s2 = s1 s1 = Replace(s2, " ", " ") Loop While Len(s1) < Len(s2) s3 = Split(s1) -- Perhaps. But allow me to shed some light on an alternate hypothesis. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Substituting substrings | Excel Programming | |||
Macro Help for Substrings | Excel Programming | |||
sum wrt substrings! | Excel Worksheet Functions | |||
Substrings in Excel? | Excel Discussion (Misc queries) | |||
STRINGS AND SUBSTRINGS ! | Excel Programming |