VBA – Use Worksheet Functions in a Macro
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:
MsgBox Application.WorksheetFunction.Combin(42, 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!
Did you find this VBA tutorial useful? Then share it with your friends and colleagues: