Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Passing a range to a user defined function
This is probably going sound like a stupid question, but .....
I recently had occasion to write a VBA function for a workbook where one of the arguments was supposed to be a range of cells, but when I try to use the function by passing a range in the form of A1:E7, I get an error saying that that argument is the wrong data type. Do I need to refer to the range differently? Was Range the wrong data type to use? |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Passing a range to a user defined function
Something like this
Public function MySum(byval rng as Range) as double MySum = Application.Sum(rng) end function -- HTH... Jim Thomlinson "Gary Nelson" wrote: This is probably going sound like a stupid question, but ..... I recently had occasion to write a VBA function for a workbook where one of the arguments was supposed to be a range of cells, but when I try to use the function by passing a range in the form of A1:E7, I get an error saying that that argument is the wrong data type. Do I need to refer to the range differently? Was Range the wrong data type to use? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Passing a range name as an argument to the Index Function | Excel Discussion (Misc queries) | |||
user defined function | Excel Worksheet Functions | |||
user defined function | Excel Worksheet Functions | |||
passing arrays to user defined functions | Excel Worksheet Functions | |||
User defined function | New Users to Excel |