How to populate a multidimensional array in VBA without loops? -
i trying create function excel (2016) using visual basic application(7.1), , part of equation includes summation including 5 empirical coefficients vary depending on of 6 conditions applies. thought best way create two-dimensional array.
i'm having trouble populating it. use formula often, , want store function in personal.xlsb. result, cannot populate through excel sheet , loop through data. since values in array empirical, not think suitable use loops in vba populate.
public function efficiency` dim cf variant cf = (array(array(0.259, -0.00000495, 0.0000000139, -0.00000000000281, 3.77e-17), _ array(0.244, 0.00000367, 0.00000000871, -0.00000000000131, 1.5e-16), _ array(0.252, -0.000000641, 0.0000000113, -0.00000000000207, -5.49e-17), _ array(0.244, 0.00000337, 0.00000000889, -0.00000000000136, -1.44e-16), _ array(0.266, -0.00000776, 0.0000000158, -0.00000000000342, 1.22e-16), _ array(0.25, 0.000000177, 0.0000000108, -0.00000000000192, 7.3e-17))) 'edit: added rest of code dim efficiency_counter: efficiency_counter=0 = 0 4 efficiency_counter = 100*(csng(cf(condition, i)))+ efficiency_counter next efficiency = 100-efficiency_counter end function
when debug, formula results in #value
, cf(0,0)
results in <subscript out of range>
error. if change variable type numeric, function displays warning
compile error: expected array
Comments
Post a Comment