Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Using FormulaArray in VBA


I need to write a function the sums two arrays and return an array as a
result. This has to be made using FormulaArray. I've tried some thing
as showed below, but doesn't work.

-Function FFF(MinhaSelecao1 As Range, MinhaSelecao2 As Range) As Range

FFF.ArrayFormula = "=" & MinhaSelecao1 & "+" & MinhaSelecao2

End Function-

Does anyone can help me?


--
marcelobf
------------------------------------------------------------------------
marcelobf's Profile: http://www.excelforum.com/member.php...o&userid=32129
View this thread: http://www.excelforum.com/showthread...hreadid=518850

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Using FormulaArray in VBA

FormulaArray is for entering an Arrayformula in a Worksheet.

Closest you could get would be

Function FFF(MinhaSelecao1 As Range, MinhaSelecao2 As Range) As Variant
FFF = Evaluate( MinhaSelecao1.Address & "+" & MinhaSelecao2.Address)
End Function


otherwise

Function FFF(MinhaSelecao1 As Range, MinhaSelecao2 As Range) As Variant
Dim v as Variant
v1 = MinhaSelecao1.Value
v2 = MinhaSelecao2.Value

for i = to 1 to ubound(v1,1)
v1(i,1) = v1(i,1) + v2(i,1)
Next
FFF = v1
End Function

This would give you a return array of the same size as the ranges passed in.

--
Regards,
Tom Ogilvy


"marcelobf" wrote in
message ...

I need to write a function the sums two arrays and return an array as a
result. This has to be made using FormulaArray. I've tried some thing
as showed below, but doesn't work.

-Function FFF(MinhaSelecao1 As Range, MinhaSelecao2 As Range) As Range

FFF.ArrayFormula = "=" & MinhaSelecao1 & "+" & MinhaSelecao2

End Function-

Does anyone can help me?


--
marcelobf
------------------------------------------------------------------------
marcelobf's Profile:

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



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
Copy FormulaArray Len Excel Programming 7 April 18th 05 12:35 PM
FormulaArray Troy Excel Worksheet Functions 1 November 23rd 04 03:42 PM
FormulaArray and Ranges Question akondra Excel Programming 3 October 9th 04 12:47 PM
FormulaArray..... HELP !!! Pierre[_6_] Excel Programming 4 May 5th 04 09:37 PM
FormulaArray UK[_2_] Excel Programming 2 February 23rd 04 05:39 PM


All times are GMT +1. The time now is 11:51 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"