Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi to all,
I want to have a userdefined function which accepts a range over more then one sheet. eg: MyFunction(Sheet1:Sheet3!A1:B10) This is code Public Function MyFunction(ByVal MyArea As ????) As Long Dim rngCell As Range Dim lngResult As Long ' Application.Volatile ' On Local Error GoTo MyFunction_err For Each rngCell In MyArea ' Do this and that to calculate lngResult Next rngCel MyFunction = lngResult GoTo CountUniqueValues_exit CountUniqueValues_err: MsgBox Err.Description, , Err.Number MyFunction = -1 CountUniqueValues_exit: Set UniqueValues = Nothing End Function With the standard function SUM you can do this. I have tried these definitions: MyFunction(ByVal MyArea As Range) = #VALUE MyFunction(ByVal MyArea As Variant) = Error 424 / Error 2015 on MyArea MyFunction(ByVal MyArea As Object) = #VALUE Any ideas? |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
same range, multiple sheets, different sorts, help please! | Excel Worksheet Functions | |||
Want to use a range name on multiple sheets | Excel Discussion (Misc queries) | |||
Sum a range across multiple sheets | Excel Worksheet Functions | |||
Changing one range on multiple sheets. | Excel Programming | |||
UserDefined Function that opens another w/book | Excel Programming |