#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10
Default SUBROUTINE HELP


I am trying to write a subroutine where A is the array of temperature
data

lenght is the number of temperature records to be searched

and MIN and Max to return the values

i want to rite a sub routine to returnt he largest and smallest value
of an array of an given length

ive starting with a calling line which is

CALL BigLittle(A,Length,Max,Min)

any help would be greAT













what do pass by adress and pass by value mean??

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default SUBROUTINE HELP

With no validation...

Option Explicit
Sub testme()

Dim myBigArray() As Double
Dim myMaximum As Double
Dim myMinimum As Double
Dim myLength As Long
Dim iCtr As Long

ReDim myBigArray(5 To 35)
For iCtr = LBound(myBigArray) To UBound(myBigArray)
'some testdate
myBigArray(iCtr) = iCtr / 100
Next iCtr

myLength = 5

Call BigLittle(myBigArray, myLength, myMaximum, myMinimum)

MsgBox myMaximum & vbLf & myMinimum

End Sub

Sub BigLittle(myArr() As Double, myLen As Long, _
myMax As Double, myMin As Double)

Dim myLittleArr() As Double
Dim iCtr As Long

ReDim myLittleArr(LBound(myArr) To LBound(myArr) + myLen)
For iCtr = LBound(myLittleArr) To UBound(myLittleArr)
myLittleArr(iCtr) = myArr(iCtr)
Next iCtr

With Application
myMax = .Max(myLittleArr)
myMin = .Min(myLittleArr)
End With

End Sub




biker man wrote:

I am trying to write a subroutine where A is the array of temperature
data

lenght is the number of temperature records to be searched

and MIN and Max to return the values

i want to rite a sub routine to returnt he largest and smallest value
of an array of an given length

ive starting with a calling line which is

CALL BigLittle(A,Length,Max,Min)

any help would be greAT

what do pass by adress and pass by value mean??


--

Dave Peterson
Reply
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
How to use this subroutine on multiple cells? Big Ian Excel Worksheet Functions 4 February 14th 06 02:01 PM
Worksheet Cell Range Name within VB Subroutine Jay Somerset Excel Discussion (Misc queries) 5 February 6th 06 02:27 PM
How do I exit a macro subroutine? John Excel Worksheet Functions 1 January 15th 06 02:08 AM
Breakpoint will not stop Excel subroutine boswald Excel Discussion (Misc queries) 2 August 24th 05 12:24 AM
How to pass a workshhet name as a parameter into a subroutine ? yigalb Excel Discussion (Misc queries) 4 January 9th 05 10:28 AM


All times are GMT +1. The time now is 08:22 PM.

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"