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: 11,058
Default Passing a range of data to a function - Excel - visual basic

In the function, use .Value:

Function splice_it(r As Range) As Long
' just like sum
Dim rr As Range
splice_it = 0
For Each rr In r
splice_it = splice_it + rr.Value
Next
End Function


in the worksheet use it like
=splice_it(A1:D4)
--
Gary's Student


"dochoa" wrote:

I am trying to pass a range of values to a Function.
Every time I try to perform a mathematical function (add, subtract, etc.) on
one of these values from the range, the function returns #value error.

Basically, I'm trying to read a range of cells containing data into an array
and then, manipulate the array mathematically. How do I accomplish this task?

Thanks!

 
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
Can I run Visual Basic procedure using Excel Visual Basic editor? john.jacobs71[_2_] Excel Programming 3 December 26th 05 02:22 PM
Range.Resize from Visual Basic in Windows to Excel MMesarch Excel Programming 2 January 27th 05 03:27 PM
Dynamically pasting function from Visual Basic to Excel cell John Fejsa Excel Programming 0 February 9th 04 11:45 PM
Visual Basic macro to do something that is done trhough an Excel function Thierry[_2_] Excel Programming 2 December 11th 03 08:58 AM


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