Re: Max/Min Functions

Tech-Archive recommends: Fix windows errors by optimizing your registry



Ok, got that. Thanks

--
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.

Jezebel wrote:
> It's not the redim vs. array that affects the risk, but using an
> array of variants where you really want an array of numbers
>
> Dim myArray() as double
>
>>
> redim myArray(1 to 3)
> myArray(1) = 1
> myArray(2) = 99.99
> myArray(3) = -34.3
>
>>
> pMax = MaxOfArray(myArray)
>
> -------
>
> Function MaxOfArray(vArray() as double) as double
>
>>
>
>
>
>
>
>
>
>
> "Greg Maxey" <gmaxey@xxxxxxxxxxxxxxxxxxx> wrote in message
> news:%236Zv$dH%23FHA.2320@xxxxxxxxxxxxxxxxxxxxxxx
>> Jezebel,
>>
>> OK, I understand that. Would you this one time just give this
>> village idiot the fish? Can you show me using my example how you
>> would change it using the Redim method to make it less risky. Thank
>> you ever so much. --
>> Greg Maxey/Word MVP
>> See:
>> http://gregmaxey.mvps.org/word_tips.htm
>> For some helpful tips using Word.
>>
>> Jezebel wrote:
>>>> I didn't use a Redim() statement. So is myArray = Array(1, 99.99,
>>>> -34.3, 50)
>>>> the same as Redim?
>>>
>>> Yes. What you've now got is an array of variants. You code works in
>>> the example you give, but it's risky because a variant array can
>>> contain *anything* -- while your MaxOfArray function assumes that
>>> the array
>>> elements can be evaluated numerically.
>>>
>>> MyArray = Array(1, ThisDocument, "XXX")
>>>
>>> etc


.



Relevant Pages

  • Re: ReDim not working as expected. Array expert needed.
    ... with ReDim, so I commented out the ReDim statement, and ran the procedure to ... Dim MyArray As Variant ' Declare nonarray variant. ... array comes out dimensioned as ... Sub ArrayStudies3 differs from Sub ArrayStudies2 only in that MyArray ...
    (microsoft.public.excel.programming)
  • Re: Sub to extract uniques from 200k data in xl03
    ... The first returns an array of the unique elements of the input array; ... Dim i As Long, p As Object, q As String ... ReDim outputArrayTransposeTo UBound, _ ...
    (microsoft.public.excel.programming)
  • Re: Sub to extract uniques from 200k data in xl03
    ... The first returns an array of the unique elements of the input array; by default it is a case-sensitive, 1-based, vertical array. ... Dim i As Long, p As Object, q As String ... ReDim outputArrayTransposeTo UBound, _ ...
    (microsoft.public.excel.programming)
  • Re: ReDim an array AFTER its loaded into another array
    ... '.RteInfo2 as string 'etc depending on how many pieces of data you need ... Redim vRteFactsAy ... ' RFA is the route facts array ... Once a "master" array is formed, it looks like the component arrays ...
    (microsoft.public.excel.programming)
  • Re: Framework 2.0 array redim unsatisfactory performance
    ... I am not talking about "array redim" anymore. ... ReDim simply allocates a new ... but I do not even attempt to test its memory ...
    (microsoft.public.dotnet.languages.vb)