LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Custom Function in Array Formula

Function MinChar(ParamArray Values() As Variant)
Dim I As Long
Dim L As Long
Dim v As Variant
K = Chr(255) + Chr(255)
For I = 0 To UBound(Values)
If IsArray(Values(I)) Then
v = Values(I)
For L = LBound(v) To UBound(v)
If VarType(Values(I)(L, 1)) = vbString Then
If K Values(I)(L, 1) Then
K = Values(I)(L, 1)
End If
End If
Next
Else
If K Values(I) Then
K = Values(I)
End If
End If
Next I
MinChar = K
End Function

--
Regards,
Tom Ogilvy

"RincewindWIZZ"
wrote in message
news:RincewindWIZZ.1plzz8_1117060753.3163@excelfor um-nospam.com...

Sorry, it makes no difference.

MinChar is

Function MinChar(ParamArray Values() As Variant)
Dim I As Integer
K = Chr(255) + Chr(255)
For I = 0 To UBound(Values)
If K Values(I) Then
K = Values(I)
End If
Next I
MinChar = K
End Function

(or its eqUivalent using a range)

Using Debug, MinChar exits with K = correct minimum value (say
"Alphonse")
In the spreadsheet, the next thing that happens is the cell takes the
value #VALUE

I suspect I am missing something simple (I hope!)

tfai


--
RincewindWIZZ
------------------------------------------------------------------------
RincewindWIZZ's Profile:

http://www.excelforum.com/member.php...o&userid=20622
View this thread: http://www.excelforum.com/showthread...hreadid=373901



 
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
Custom Function I can use in a formula? John WEC Excel Discussion (Misc queries) 0 May 13th 10 08:03 PM
Custom Function in Array Formula RincewindWIZZ Excel Programming 1 May 25th 05 06:20 PM
Passing an array as argument for custom Function No Name Excel Programming 4 March 7th 05 04:44 PM
Preformatted array returned by custom function Asif[_3_] Excel Programming 9 December 4th 03 06:31 AM
returning an array from a custom function Ron Davis Excel Programming 2 September 15th 03 11:02 AM


All times are GMT +1. The time now is 08:16 AM.

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"