Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Format when sending a range as parameter to a custom function

Hello,

I created a custom functiom for which I need to send a range (A1:A5), that I
will loop throu in my function.

Please indicate what the funtion definition will looklike, ie how do I
specify that it will receive a range in that format? I do have the code that
will loop through the cells.

Kind regards

George
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default Format when sending a range as parameter to a custom function

Something like this... (hard to tell from your question)

Public Sub SendRange()
Dim dblAmount As Double

dblAmount = RecieveRange(Sheets("Sheet1").Range("A1:A5"))
MsgBox "The total is " & dblAmount
End Sub

Public Function RecieveRange(ByVal MyRange As Range) As Double
Dim rng As Range
Dim dblTotal As Double

For Each rng In MyRange
dblTotal = dblTotal + rng.Value
Next rng
RecieveRange = dblTotal
End Function

--
HTH...

Jim Thomlinson


"George Furnell" wrote:

Hello,

I created a custom functiom for which I need to send a range (A1:A5), that I
will loop throu in my function.

Please indicate what the funtion definition will looklike, ie how do I
specify that it will receive a range in that format? I do have the code that
will loop through the cells.

Kind regards

George

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Format when sending a range as parameter to a custom function

Thank you so much.
Kind regards

George
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
Custom Format or use function? Lisa W Excel Worksheet Functions 4 July 21st 09 06:06 PM
user defined function receiving a range as parameter Marc Excel Programming 7 October 14th 05 07:50 PM
Excel2000: Reading values from range, passed to function as parameter using an expression Arvi Laanemets Excel Programming 3 April 29th 05 02:34 PM
Defining new function with cell range parameter NormD Excel Programming 2 March 1st 05 03:21 PM
Translate range name passed as string to a custom function to range addresses! agarwaldvk[_25_] Excel Programming 3 September 7th 04 12:47 PM


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