简体   繁体   中英

How can I access a [vba] function from a different [excel] workbook

I have a pretty simple, but frequently used function, However I generally need to use it on new excel docs. To manually add in the code for the function to each workbook will be defeating the purpose of the function... Is there any way to access a function that is not stored in the active workbook?

See the code below if it might help you understand what I need:

Function potential(ByVal Volume As Double, ByVal Original As Double, Optional ByVal Better As Double = 0) As Double
    If Better = 0 Then Exit Function
    potential = (Original - Better) * Volume
End Function

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