No, the pSplit routine will never be as fast as the inbuilt method.
--
HTH
RP
(remove nothere from the email address if mailing direct)
"CoRrRan" <CoRrRan~~[at]~~gmail~~[dot]~~com> wrote in message
news:Xns96007B5D245CCoRrRan@194.109.133.29...
> This seems to work... however, I need this function to be fast, as it
> will be used very often in the main-routine. Do you think both functions
> are equally fast when called >1000 times in 1 procedure?
>
> Thanks for the quick reply!
>
> CoRrRan
>
> P.S. The other option is (of course) to change the main procedure from
> being mainly BASE 1 to BASE 0 for using the ExtractData-function. (But
> this requires a lot of (debug-)time, which I do not have.
>
> "Bob Phillips" <bob.phillips@notheretiscali.co.uk> wrote in
> news:#WBmw5HFFHA.2180@TK2MSFTNGP10.phx.gbl:
> > Try this modified SPlit function (with Option Base 1)
> >
> > '-----------------------------------------------------------------
> > Function pSplit(Text As String, _
> > Optional Delimiter As String = ",") As Variant
> > '-----------------------------------------------------------------
> > Dim i As Long
> > Dim sFormula As String
> > Dim aryEval
> > Dim aryValues
> >
> > If Delimiter = vbNullChar Then
> > Delimiter = Chr(7)
> > Text = Replace(Text, vbNullChar, Delimiter)
> > End If
> > sFormula = "{""" & Application.Substitute(Text, Delimiter,
> > """,""") &
> > """}"
> > aryEval = Evaluate(sFormula)
> > pSplit = aryEval
> >
> > End Function
> >
> >
> > --
> >
> > HTH
> >
> > RP
> > (remove nothere from the email address if mailing direct)
> >
> >
> > "CoRrRan" <CoRrRan~~[at]~~gmail~~[dot]~~com> wrote in message
> > news:Xns96001F833589CoRrRan@194.109.133.29...
> >> I want to use the Split function in a custom made function and want
> >> the output to be used in a main procedure.
> >>
> >> My problem is with the following code:
> >>
> >> ***************************************************
> >> Public Function ExtractData(TextString as String, _
> >> Separator as String, _
> >> Optional Block_N as integer = 0)
> >>
> >> Dim StringToArray As String
> >>
> >> StringToArray = Split(Expression:=DataString, _
> >> Delimiter:=Separator, _
> >> Limit:=-1)
> >>
> >> ExtractData = StringToArray
> >>
> >> End Function
> >> ***************************************************
> >>
> >> (This is not my original function, but it'll do for my question.)
> >>
> >> My output of this function would be in BASE 0, and I want this in
> >> BASE 1.
> >>
> >> I have tried placing "OPTION BASE 1" at the top of my procedure, but
> >> it seems that the "Split"-function can only return an array with BASE
> >> 0.
> >>
> >> Can any1 tell me if there is a way to obtain the result from above
> >> function with BASE 1, without having to ReDim the
> >> ExtractData-variable and filling it again with the items from the
> >> StringToArray-variable?
> >>
> >> Hopefully someone can give me an answer to this one.
> >>
> >> TIA,
> >> CoRrRan
Bookmarks