Solved

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

Posted on 2014-12-28
2
102 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 Covney
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
 
LVL 3

Author Comment

by:Ed Covney
ID: 40520759
Graham -

I tried it and I like it !!!

Thank you, thank you, thank you.

- Ed
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Office 365 PST import 6 36
OUTLOOK 2016 receive time interval 8 57
Excel Formula to Iterate 4 15
WORKDAY formula question 4 13
My experience with Windows 10 over a one year period and suggestions for smooth operation
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

696 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