VBA – Use Worksheet Functions in a Macro

Associated Files Download Links


The ability to use Excel’s built in functions when programming with VBA can be a great time saver.

In this example I’ll use the Combin function. Remember Combin is used to return the maximum combinations when given the number in the pool and the number drawn. The following code demonstrates a worksheet function used in VBA to find the combinations when given a pool of 42 with a draw of 6:

Running this macro tells us in a message box the result of the Combin function, and we’ve successfully used a worksheet function with VBA.

VBA Coding Made Easy

Stop searching for VBA code online. Learn more about AutoMacro – A VBA Code Builder that allows beginners to code procedures from scratch with minimal coding knowledge and with many time-saving features for all users!

alt text

Learn More!

<<Return to VBA Examples

Did you find this VBA tutorial useful? Then share it with your friends and colleagues:

You may also like some of this related content...

VBA has many string functions that will allow you to manipulate and work with text
VBA Round The VBA Round Function rounds numbers to a specified number of digits. Syntax
While working in VBA, you often need to convert strings into lowercase, uppercase or proper
Every character in Excel has an assigned number code to itself. The Chr function in
In this article, you will learn how to use the IsEmpty function in VBA to