Return a User Defined Data Type in an Excel Cell

后端 未结 3 1645
广开言路
广开言路 2020-12-07 03:01

I\'ve searched the web and I\'ve searched the questions here on stackoverflow, but I haven\'t been able to find a solution.

Here is what I\'d like to do:

Sup

3条回答
  •  伪装坚强ぢ
    2020-12-07 03:38

    The nesting won't work because myvar goes out of scope as soon as the UDF is done executing. There actually may be other problems associated with trying to return an object in a worksheet function (most certainly there are), but even if there weren't the scope problem would still kill it.

    You could store a pointer to the object in a cell and get the object via that pointer, but again the scope will kill it. To get the object from the pointer, it would have to remain in scope, so why bother storing the pointer.

    Obviously your real life situation is more complex than your example. So the answer is no as to storing objects in cells, but if you explain what you're trying to accomplish there may be alternatives.

提交回复
热议问题