Forum Discussion

Rodolfo_Oviedo's avatar
Rodolfo_Oviedo
Copper Contributor
Feb 26, 2019
Solved

VBA CSE array UDF and dynamic arrays

CSE = Ctr+Shift+Enter
UDF = User Defined Function
In a row, I have a some inputs of a VBA CSE row array UDF located in the same row. The array function is copied down. The inputs of each copy are in the corresponding row. Now, all array functions have an additional common argument which is a big range located in another sheet, which has a name assigned. Each instance of the array UDF passes this big range to VBA, which is time inefficient. I wonder if using dynamic arrays can avoid such inefficiency. Can I enter the row array UDF only in the first row with the named range common argument, and dynamic column arrays in the place of the other arguments?
  • Depends on how you pass the large range. If the declaration is of type Range or Variant, you are just passing an object reference. Whether the range is one cell or 10000 makes no difference for the time it takes to pass the object pointer.

1 Reply

  • JKPieterse's avatar
    JKPieterse
    Silver Contributor
    Depends on how you pass the large range. If the declaration is of type Range or Variant, you are just passing an object reference. Whether the range is one cell or 10000 makes no difference for the time it takes to pass the object pointer.

Resources