0

I have a custom Excel function but when typing it there is no parameter seems. How can I show the parameters of this function like default Excel functions like below?

enter image description here

My Excel function:

Public Function DiscreteEmp(ByVal rng As Range)

c = rng.Rows.Count
Dim bounds() As Double
ReDim bounds(1 To c + 1) As Double
Dim vals() As Double
ReDim vals(1 To c + 1) As Double
bounds(1) = 0

For i = 1 To c
bounds(i + 1) = bounds(i) + rng.Cells(i, 1).Value
vals(i) = rng.Cells(i, 2).Value
Next i

num = Rnd
If num = 0 Then
DiscreteEmp = vals(1)
End If
For i = 1 To c
If num > bounds(i) And num <= bounds(i + 1) Then
DiscreteEmp = vals(i)
Exit For
End If
Next i

End Function
Community
  • 1
  • 1
Ali Tor
  • 2,772
  • 2
  • 27
  • 58

0 Answers0