Permut is an excel function that returns the number of permutations for a given number of objects that can be selected from number objects. A permutation is any set or subset of objects or events where internal order is significant.
I was trying to use Permut in my macro and thought that I can just write permut(num1, num2) but it returns a function/sub error message when it’s run.
The trick is to wrap permut in a Application.Evaluate, for example:
Application.Evaluate(“permut(5,2)”)
If you have variables such as num1 and num2, then it would be written as such in your macro
Application.Evaluate(“permut(” & num1 & “,” & num2 & “)”)
This same method can be applied to the excel function combin as well.
Leave a Reply