Solved

How do I call an Excel Function (COMBIN) from my user created function?

Posted on 2014-12-28
2
86 Views
Last Modified: 2015-01-12
I pass 4 variables to a VBA function, and from them calculate 8 dependent variables from which I need to calculate and pass back to the Excel cell:

FName = ( Combin(n1,n2) * Combin(n3,n4 ) +  ( Combin(n5,n6) * Combin(n7,n8 ) )

One by one I can return n1 - n8 and the numbers are correct, but I can't even get constants to work:  i.e.  FName  =  Combin(5,3)

Err: (With "Combin" hi-lited):   Compile error: Sub or Function not defined

Any help with syntax will be greatly appreciated.

- Ed
0
Comment
Question by:Ed-SSA
2 Comments
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 500 total points
ID: 40520697
Try it like this

With Application.WorksheetFunction
    Fname = .Combin(n1, n2) * .Combin(n3, n4) + .Combin(n5, n6) * .Combin(n7, n8)
End With

Open in new window

0
 

Author Comment

by:Ed-SSA
ID: 40520759
Graham -

I tried it and I like it !!!

Thank you, thank you, thank you.

- Ed
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Recently Microsoft released a brand new function called CONCAT. It's supposed to replace its predecessor CONCATENATE. But how does it work? And what's new? In this article, we take a closer look at all of this - we even included an exercise file for…
Outlook Free & Paid Tools
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now