Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
It's probably not possible, but I wonder if I can build a generic sub that
builds a function name at runtime using Evaluate (or another method)? For example, I have a function CalcRSI which works fine. CalcRSI(DataSeries as single, Periods as integer) as Variant I have other functions CalcSMA, CalcEMA, CalcWhatever that take the same arguments. Rather than explicitly call each one, separately, I would like to build a generic sub that funnels all my functions (that use the same inputs). So I'd like to replace x = CalcRSI(same arguments) y = CalcSMA(same arguments) z= CalcEMA(same arguments) with strCalcName = "Calc" & strName x = Evaluate(strCalcName & "(" & arg1 & "," & arg2 & ")" ) I have other reasons for wanting to simplify this process that are not relevant here. The above compiles ok, but at runtime, I get "Run-time error 13 Type mismatch", at the x = Evaluate(...) line. I guess Excel is telling me it can't be done, and yet, ... It really will make a difference if I can do this, but I'm not optimistic. Thanks in advance, and I won't shoot the messenger. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Evaluate function | Excel Worksheet Functions | |||
Evaluate a Variable Name from a String | Excel Programming | |||
evaluate a function | Excel Programming | |||
Evaluate using a variable - Help please | Excel Programming | |||
EVALUATE Function | New Users to Excel |