Forum Discussion

Wim_Coenen's avatar
Wim_Coenen
Copper Contributor
Dec 21, 2022
Solved

Programming in visual basic

Good day,

 

I want to use the function combinations in a program.
However, get an error, #value
A data type in the formula would be wrong.

I used the following source code.

 

Public Function Nob(a As Integer, b As Integer) As Double
Nob = Application.WorksheetFunction.Combin(a, b)
End Function

 

I'm grateful for any solution.

Thanks in advance, Wim Coenen

 

  • Wim_Coenen 

    Make sure that a is greater than or equal to b.

     

    =Nob(5, 2) should work - or if you use comma as decimal separator, =Nob(5; 2)

    But =Nob(2, 5) will return #VALUE!

1 Reply

  • Wim_Coenen 

    Make sure that a is greater than or equal to b.

     

    =Nob(5, 2) should work - or if you use comma as decimal separator, =Nob(5; 2)

    But =Nob(2, 5) will return #VALUE!

Resources