Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello
I am trying to do something specific but not sure of the right syntax to use in VBA. Basically I have the option to do several kind of calculations, on some given variables like Option 1: do the sum Option 2: take the max Option 3: do the product Now in my code I have a parameter that will say whether I should do the calculation of the option 1, 2 or 3. The easy way to formulate it is simply by doing a select/case, or by running a loop going through every option and comparing if this is the option I want to use. Now if the number of different options is significant, and this is looped many times, it can be quite time consuming and unnecessary. What I would like to do is having an integer "N" that would say which calculation to do. N would be worth 1, 2 or 3 and I would go directly to the right option, but I am stuck there. How would you select a specific calculation based on N? Ideally I would like to have a sort of array of functions "TheArrayOfSubs" (for instance subs) such that I can do call TheArrayOfSubs(2) and it would directly run the sub corresponding to option 2. Or something like that. Would any one have an idea of how to code that? thanks Charles |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Tricky array problem…. | Excel Discussion (Misc queries) | |||
Tricky Tricky episode 2!!! | Excel Programming | |||
efficiency: database functions vs. math functions vs. array formula | Excel Discussion (Misc queries) | |||
Need help with a tricky problem of placing a number within an array... | Excel Worksheet Functions | |||
Tricky array formula issue - Using array formula on one cell, then autofilling down a range | Excel Programming |