Call VBA macros / functions in another workbook

I'd like to consolidate some of my VBA code into one workbook and then make the Function call from other workbooks. I use the same functions in several different workbooks and its difficult to maintain code consistency between them.

Here is the current code/call:
Range(Cell).Value = ServiceLaborSF(BegDate, EndDate)

How can I do this?

Thanks
bikeskiAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

rspahitzCommented:
Probably the easiest way is to put it into your Personal Workbook and make the function public (or at least not private)

Public Sub ServiceLaborSF(BegDate As Date, EndDate As Date) As Range' word Public optional
...
End Sub

Alternately, you can put this into ANY workbook and it can be used as long as the workbook is open (which is a good reason to use the Personal Workbook since it's always open.)

Note that if you plan to distribute this to other, the Personal Workbook is not the best choice.
bikeskiAuthor Commented:
We have several users accessing several different workbooks at various times. I don't believe this will work.

How does Application.Run work with Functions?
rspahitzCommented:
I've never seen that used with functions.  However, you could get it to perform at action, like open a workbook (maybe hidden) that has a collection of functions, then you should be able to reference them. I've never tried it so it may have some weird side-effects while it tries to load the book so there may be some timing issues.

So can you simply ensure that users open the "Functions" workbook (rather than Personal workbook)? It could be something done in the Workbook Open even if they use the same workbooks over and over...and, again, that workbook can be set to hidden...but make sure to close it when not needed any more.
Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

Roy CoxGroup Finance ManagerCommented:
You could create an excel addin containing the Functions then install it on the network. These articles should help

EXCEL - UDF

Deploying Add-ins in a Network Environment

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bikeskiAuthor Commented:
Straight forward solution with useful links for creating and maintaining the add-on's.
Roy CoxGroup Finance ManagerCommented:
Pleased to help
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.