Solved

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

Posted on 2014-12-28
2
85 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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

This article will show you how to use shortcut menus in the Access run-time environment.
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

746 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

10 Experts available now in Live!

Get 1:1 Help Now