Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If I am interpretting your problem correctly then declare the array as
Variant then the min function ignores any empty elements except when all are empty min returns zero. (I think you have established that.) Therefore test for min returning zero and if so assume all are empty or zero else run min function to return a number other than zero. Following example populates just some elements of an array declared as variant and you will see that min returns the correct minimum value of 3. Sub MinFctnWithArray() Dim MyArray() As Variant Dim i ReDim MyArray(1 To 10) For i = 3 To 10 Step 2 MyArray(i) = i Next i For i = 1 To 10 MsgBox "Array element " & i & " = " & MyArray(i) Next i If WorksheetFunction.Min(MyArray()) = 0 Then MsgBox "All elements in MyArray are empty or zero." Else MsgBox "Min value in array is " & WorksheetFunction.Min(MyArray()) End If End Sub -- Regards, OssieMac |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
clearing an array | Excel Programming | |||
Clearing Array Contents | Excel Programming | |||
Array for clearing checkboxes | Excel Programming | |||
clearing array contents | Excel Programming | |||
vba clearing out values stored in array | Excel Programming |