LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default UDF with several cells output

Thanks for your response.
I'm not sure that I understand what you are suggesting.

I added an example code. The function takes the range and returns only
the negative numbers. As it is, the user has to select enough cells and
use it as an array function (Ctrl+Shift+Enter).

Function testit(inputRange As Range)

Dim output() As Double
Dim i As Integer

i = 0

For Each c In inputRange.Cells

If (c.Value < 0) Then
ReDim Preserve output(i)
output(UBound(output)) = c.Value
i = i + 1
End If

Next c

testit = output

End Function

 
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 get average of successive x-number cells to output in colum dysonsphere Excel Discussion (Misc queries) 3 January 23rd 09 03:55 PM
Comparing cells and output text Rocketeer Excel Worksheet Functions 7 May 19th 08 12:14 AM
Confusing output from cells Shackdelta Excel Discussion (Misc queries) 2 October 21st 05 03:04 PM
Getting output from an excel output back to cscript.. J S Excel Programming 0 January 21st 04 09:06 PM
Custom function to return output in multiple cells Asif[_3_] Excel Programming 1 December 2nd 03 06:22 PM


All times are GMT +1. The time now is 05:13 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"