Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
OK, I have looked everywhere, and I cannot find the answer to what must
be a simple question; how do I support ranges and individual cells with the same function? In the way that I can put a function in a cell that is "=SUM(E10,F10,G10,G14:G21)" I also want to be able to pass the same type of data into a user defined function of my own. So far, I have found two function declarations that work well: Public Function CellsVar(ParamArray InRange() As Variant) and Public Function CellsRange(InRange As Range) The CellsVar form works as long as individual cells are comma separated. The second form, CellsRange, works just fine with a single range delimited with a colon. However, I have not been able to find a form that allows both. Going back to the example above with the sum function, how do I declare the function so as to support both? I am hopeful that the result keeps the simplicity of the code within the function, whic resembles the following: For Each cell In InRange blah blah blah Next cell Thanks in advance for your help!! I cannot figure out why the answer is so elusive. This seems like Excel programming 101, and should appear somewhere in the docs.... |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
how copy formula that contains ranges so ranges do not overlap | Excel Worksheet Functions | |||
3D Ranges | Excel Worksheet Functions | |||
Like 123, allow named ranges, and print named ranges | Excel Discussion (Misc queries) | |||
Array Parameters as Variants Only | Excel Programming | |||
named ranges - changing ranges with month selected | Excel Programming |