sql - Is there a way for VBA UDF to "know" what other functions will be run? -



sql - Is there a way for VBA UDF to "know" what other functions will be run? -

assume have udf used in worksheet 100,000+ times. there way, within function, know how many more times going called in batch? want have every function create to-do list of work do. want like:

if remaining functions executed after 1 = 0 ...

is there way this?

background:

i want create udf perform sql queries user giving parameters(date, hour, node, type). pretty easy create if you're willing execute sql query every time function run. know easy because did , ridiculously slow. new thought have function first see if info looking exists in global cache variable , if isn't add together global variable "job-list".

what want when lastly function called go through job list , perform fewest number of sql queries , fill global cache variable. 1 time cache variable total table refresh create other functions called 1 time again since on subsequent phone call they'll find info need in cache.

firstly: vba udf performance extremely sensitive way udf coded: see series of posts writing efficient vba udfs:

http://fastexcel.wordpress.com/2011/06/13/writing-efficient-vba-udfs-part-3-avoiding-the-vbe-refresh-bug/

http://fastexcel.wordpress.com/2011/05/25/writing-efficient-vba-udfs-part-1/

you should consider using array udf homecoming multiple results: http://fastexcel.wordpress.com/2011/06/20/writing-efiicient-vba-udfs-part5-udf-array-formulas-go-faster/ secondly: 12th post in series outlines using aftercalculate event , cache http://fastexcel.wordpress.com/2012/12/05/writing-efficient-udfs-part-12-getting-used-range-fast-using-application-events-and-a-cache/ basically approach need udf check cache & if not current or available add together request queue. utilize after-calculation event process queue , if neccessary trigger recalc.

sql excel excel-vba user-defined-functions excel-2010

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -