简体   繁体   中英

Can I use another open workbook's VBA Functions in another open workbook within a Cell formula?

I have some VBA functions defined within my Personal.xlsb that I want to use in the Cell formulae for other opened workbooks. I can use these functions within Cell formulae within worksheets in Personal.xlsb, however I can't seem to use these within other opened workbooks... I get the #NAME errors whinging that it can't find the function name.

I hope I've just done something stupid..

FYI for example, one function accepts some arguments including a Cell, and returns an element from the cell's value at a particular position (say Cell.Value = This.Is.An.Example, the function might return "An") effectively replicating a split()[2]

Cheers

You need to reference functions in the Personal.xlsb with the filename, like this:

=PERSONAL.XLSB!myFunctionName(A1)

If you don't want to do that for each function, you can create a reference in your new workbook's VBE. Go Tools > References and find the workbook in the list.

See a walkthrough of the whole process here: https://www.myonlinetraininghub.com/creating-a-reference-to-personal-xlsb-for-user-defined-functions-udfs

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM