<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Max() Function in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/max-function/m-p/341126#M83076</link>
    <description>... nope -- hafta write'em -- (lisp has them -- funny why VBA doesn't):&lt;BR /&gt;
&lt;BR /&gt;
Syntax for all four functions below:&lt;BR /&gt;
&lt;BR /&gt;
Minimum(1,2,5,6,3,etc...)&lt;BR /&gt;
Min(Array)&lt;BR /&gt;
Maximum(1,2,5,6,3,etc...)&lt;BR /&gt;
Max(Array)&lt;BR /&gt;
&lt;BR /&gt;
'================================== watch for word wrap&lt;BR /&gt;
&lt;BR /&gt;
Public Function Minimum(ParamArray Numbers())&lt;BR /&gt;
    Minimum = Min(Numbers)&lt;BR /&gt;
End Function&lt;BR /&gt;
&lt;BR /&gt;
Public Function Maximum(ParamArray Numbers())&lt;BR /&gt;
    Maximum = Max(Numbers)&lt;BR /&gt;
End Function&lt;BR /&gt;
&lt;BR /&gt;
'Send back the minimum value from a list of numbers&lt;BR /&gt;
Public Function Min(ByVal NumericArray As Variant) As Variant&lt;BR /&gt;
    Dim i As Integer&lt;BR /&gt;
    Dim MinVal As Double&lt;BR /&gt;
    Dim CurVal As Double&lt;BR /&gt;
    CurVal = NumericArray(0)&lt;BR /&gt;
    MinVal = CurVal&lt;BR /&gt;
    For i = LBound(NumericArray) + 1 To UBound(NumericArray)&lt;BR /&gt;
        CurVal = NumericArray(i)&lt;BR /&gt;
        If CurVal &amp;lt; MinVal Then MinVal = CurVal&lt;BR /&gt;
    Next&lt;BR /&gt;
    Min = MinVal&lt;BR /&gt;
End Function&lt;BR /&gt;
&lt;BR /&gt;
'Send back the maximum value from a list of numbers&lt;BR /&gt;
Public Function Max(ByVal NumericArray As Variant) As Variant&lt;BR /&gt;
    Dim i As Integer&lt;BR /&gt;
    Dim MaxVal As Double&lt;BR /&gt;
    Dim CurVal As Double&lt;BR /&gt;
    CurVal = NumericArray(0)&lt;BR /&gt;
    MaxVal = CurVal&lt;BR /&gt;
    For i = LBound(NumericArray) + 1 To UBound(NumericArray)&lt;BR /&gt;
        CurVal = NumericArray(i)&lt;BR /&gt;
        If CurVal &amp;gt; MaxVal Then MaxVal = CurVal&lt;BR /&gt;
    Next&lt;BR /&gt;
    Max = MaxVal&lt;BR /&gt;
End Function</description>
    <pubDate>Fri, 29 Jun 2001 09:07:24 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2001-06-29T09:07:24Z</dc:date>
    <item>
      <title>Max() Function</title>
      <link>https://forums.autodesk.com/t5/vba-forum/max-function/m-p/341125#M83075</link>
      <description>Is it possible to find the largest of a group of numbers in Acad VBA similar&lt;BR /&gt;
to the Excel Max() function?&lt;BR /&gt;
&lt;BR /&gt;
Best regards,&lt;BR /&gt;
&lt;BR /&gt;
Dale</description>
      <pubDate>Fri, 29 Jun 2001 08:20:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/max-function/m-p/341125#M83075</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2001-06-29T08:20:51Z</dc:date>
    </item>
    <item>
      <title>Re: Max() Function</title>
      <link>https://forums.autodesk.com/t5/vba-forum/max-function/m-p/341126#M83076</link>
      <description>... nope -- hafta write'em -- (lisp has them -- funny why VBA doesn't):&lt;BR /&gt;
&lt;BR /&gt;
Syntax for all four functions below:&lt;BR /&gt;
&lt;BR /&gt;
Minimum(1,2,5,6,3,etc...)&lt;BR /&gt;
Min(Array)&lt;BR /&gt;
Maximum(1,2,5,6,3,etc...)&lt;BR /&gt;
Max(Array)&lt;BR /&gt;
&lt;BR /&gt;
'================================== watch for word wrap&lt;BR /&gt;
&lt;BR /&gt;
Public Function Minimum(ParamArray Numbers())&lt;BR /&gt;
    Minimum = Min(Numbers)&lt;BR /&gt;
End Function&lt;BR /&gt;
&lt;BR /&gt;
Public Function Maximum(ParamArray Numbers())&lt;BR /&gt;
    Maximum = Max(Numbers)&lt;BR /&gt;
End Function&lt;BR /&gt;
&lt;BR /&gt;
'Send back the minimum value from a list of numbers&lt;BR /&gt;
Public Function Min(ByVal NumericArray As Variant) As Variant&lt;BR /&gt;
    Dim i As Integer&lt;BR /&gt;
    Dim MinVal As Double&lt;BR /&gt;
    Dim CurVal As Double&lt;BR /&gt;
    CurVal = NumericArray(0)&lt;BR /&gt;
    MinVal = CurVal&lt;BR /&gt;
    For i = LBound(NumericArray) + 1 To UBound(NumericArray)&lt;BR /&gt;
        CurVal = NumericArray(i)&lt;BR /&gt;
        If CurVal &amp;lt; MinVal Then MinVal = CurVal&lt;BR /&gt;
    Next&lt;BR /&gt;
    Min = MinVal&lt;BR /&gt;
End Function&lt;BR /&gt;
&lt;BR /&gt;
'Send back the maximum value from a list of numbers&lt;BR /&gt;
Public Function Max(ByVal NumericArray As Variant) As Variant&lt;BR /&gt;
    Dim i As Integer&lt;BR /&gt;
    Dim MaxVal As Double&lt;BR /&gt;
    Dim CurVal As Double&lt;BR /&gt;
    CurVal = NumericArray(0)&lt;BR /&gt;
    MaxVal = CurVal&lt;BR /&gt;
    For i = LBound(NumericArray) + 1 To UBound(NumericArray)&lt;BR /&gt;
        CurVal = NumericArray(i)&lt;BR /&gt;
        If CurVal &amp;gt; MaxVal Then MaxVal = CurVal&lt;BR /&gt;
    Next&lt;BR /&gt;
    Max = MaxVal&lt;BR /&gt;
End Function</description>
      <pubDate>Fri, 29 Jun 2001 09:07:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/max-function/m-p/341126#M83076</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2001-06-29T09:07:24Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/vba-forum/max-function/m-p/341127#M83077</link>
      <description>Dale and Lanny,&lt;BR /&gt;
&lt;BR /&gt;
Is this what you are referring to?&lt;BR /&gt;
&lt;BR /&gt;
Public oExcel As New Excel.Application&lt;BR /&gt;
&lt;BR /&gt;
Public Sub DoesThisWork()&lt;BR /&gt;
  Debug.Print oExcel.WorksheetFunction.Max(12, 13, 2, 1, 0, 42)&lt;BR /&gt;
End Sub&lt;BR /&gt;
&lt;BR /&gt;
Don't forget to set your reference to Excel.&lt;BR /&gt;
&lt;BR /&gt;
--&lt;BR /&gt;
Get on the emailing list for notification of the NEW "AutoCAD Visual Basic&lt;BR /&gt;
Programmers Reference" - the ultimate guide to Visual Basic programming for&lt;BR /&gt;
R14/2000/2000i&lt;BR /&gt;
and 2002 by clicking on the link below&lt;BR /&gt;
mailto:omnisource@worldnet.att.net?subject=NewVBTitle&lt;BR /&gt;
&lt;BR /&gt;
Joe Sutphin&lt;BR /&gt;
Author of "AutoCAD 2000 VBA Programmers Reference"&lt;BR /&gt;
ISBN #1861002564&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
"Lanny Schiele" &lt;LSCHIELE&gt; wrote in message&lt;BR /&gt;
news:682BA3B8C4D8F0956B7CF9F65DC6CEDA@in.WebX.maYIadrTaRb...&lt;BR /&gt;
&amp;gt; ... nope -- hafta write'em -- (lisp has them -- funny why VBA doesn't):&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Syntax for all four functions below:&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Minimum(1,2,5,6,3,etc...)&lt;BR /&gt;
&amp;gt; Min(Array)&lt;BR /&gt;
&amp;gt; Maximum(1,2,5,6,3,etc...)&lt;BR /&gt;
&amp;gt; Max(Array)&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; '================================== watch for word wrap&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Public Function Minimum(ParamArray Numbers())&lt;BR /&gt;
&amp;gt;     Minimum = Min(Numbers)&lt;BR /&gt;
&amp;gt; End Function&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Public Function Maximum(ParamArray Numbers())&lt;BR /&gt;
&amp;gt;     Maximum = Max(Numbers)&lt;BR /&gt;
&amp;gt; End Function&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; 'Send back the minimum value from a list of numbers&lt;BR /&gt;
&amp;gt; Public Function Min(ByVal NumericArray As Variant) As Variant&lt;BR /&gt;
&amp;gt;     Dim i As Integer&lt;BR /&gt;
&amp;gt;     Dim MinVal As Double&lt;BR /&gt;
&amp;gt;     Dim CurVal As Double&lt;BR /&gt;
&amp;gt;     CurVal = NumericArray(0)&lt;BR /&gt;
&amp;gt;     MinVal = CurVal&lt;BR /&gt;
&amp;gt;     For i = LBound(NumericArray) + 1 To UBound(NumericArray)&lt;BR /&gt;
&amp;gt;         CurVal = NumericArray(i)&lt;BR /&gt;
&amp;gt;         If CurVal &amp;lt; MinVal Then MinVal = CurVal&lt;BR /&gt;
&amp;gt;     Next&lt;BR /&gt;
&amp;gt;     Min = MinVal&lt;BR /&gt;
&amp;gt; End Function&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; 'Send back the maximum value from a list of numbers&lt;BR /&gt;
&amp;gt; Public Function Max(ByVal NumericArray As Variant) As Variant&lt;BR /&gt;
&amp;gt;     Dim i As Integer&lt;BR /&gt;
&amp;gt;     Dim MaxVal As Double&lt;BR /&gt;
&amp;gt;     Dim CurVal As Double&lt;BR /&gt;
&amp;gt;     CurVal = NumericArray(0)&lt;BR /&gt;
&amp;gt;     MaxVal = CurVal&lt;BR /&gt;
&amp;gt;     For i = LBound(NumericArray) + 1 To UBound(NumericArray)&lt;BR /&gt;
&amp;gt;         CurVal = NumericArray(i)&lt;BR /&gt;
&amp;gt;         If CurVal &amp;gt; MaxVal Then MaxVal = CurVal&lt;BR /&gt;
&amp;gt;     Next&lt;BR /&gt;
&amp;gt;     Max = MaxVal&lt;BR /&gt;
&amp;gt; End Function&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;/LSCHIELE&gt;</description>
      <pubDate>Fri, 29 Jun 2001 09:33:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/max-function/m-p/341127#M83077</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2001-06-29T09:33:13Z</dc:date>
    </item>
  </channel>
</rss>

