Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 52
Default Function with parameter "as range"

What are you supposed to pass to a function that has a parameter "range" data
type? I have tried the following:
msgbox functionname(range("a1:a10").address)
msgbox functionname(range("a1:a10").range)
msgbox functionname(range("a1:a10"))
msgbox functionname("a1:a10")
msgbox functionname(a1:a10)


--
Thanks,
Mike
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Function with parameter "as range"

It should be

msgbox functionname(range("a1:a10"))


What hapopens when you do that? Can it handle multiple cells?

--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)

"Mike Archer" wrote in message
...
What are you supposed to pass to a function that has a parameter "range"

data
type? I have tried the following:
msgbox functionname(range("a1:a10").address)
msgbox functionname(range("a1:a10").range)
msgbox functionname(range("a1:a10"))
msgbox functionname("a1:a10")
msgbox functionname(a1:a10)


--
Thanks,
Mike



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default Function with parameter "as range"

Mike

an example:

Function FunctionName(ByVal rng As Range)
N = 0
For Each cell In rng
N = N + cell.Value
Next
FunctionName = N
End Function

Sub test()
MsgBox FunctionName(Range("g1:g5"))
End Sub

Or from a worksheet:
=FunctionName(g1:g5)

HTH

"Mike Archer" wrote:

What are you supposed to pass to a function that has a parameter "range" data
type? I have tried the following:
msgbox functionname(range("a1:a10").address)
msgbox functionname(range("a1:a10").range)
msgbox functionname(range("a1:a10"))
msgbox functionname("a1:a10")
msgbox functionname(a1:a10)


--
Thanks,
Mike

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 486
Default Function with parameter "as range"

It should be like this
msgbox functionname(range("a1:a10"))

Which is passing cells A1:A10 of the acitve sheet to the function. If that
is not working you will need to post your code...
--
HTH...

Jim Thomlinson


"Mike Archer" wrote:

What are you supposed to pass to a function that has a parameter "range" data
type? I have tried the following:
msgbox functionname(range("a1:a10").address)
msgbox functionname(range("a1:a10").range)
msgbox functionname(range("a1:a10"))
msgbox functionname("a1:a10")
msgbox functionname(a1:a10)


--
Thanks,
Mike

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
Parameter "TwoDimension" on RowVector function andrew79 Excel Worksheet Functions 1 January 11th 10 03:06 PM
"Empty" values in holiday parameter for NETWORKDAYS() function RMTP Excel Worksheet Functions 6 April 30th 06 12:51 AM
use variable in Workbooks("book1").Worksheets("sheet1").Range("a1" Luc[_3_] Excel Programming 2 September 28th 05 08:37 PM
Using "Cells" to write "Range("A:A,H:H").Select" Trip Ives[_2_] Excel Programming 3 June 5th 04 03:13 PM


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