# Macro function returns "too many arguments' error

#### incajunk

##### New Member
When I insert the function pv() it returns an errorr message "You've entered too many arguments for this function." But I haven't called out too many arguments. Even worse is that I can call out functions pm(), pq() or pd() which are all similar but work! Here is the code for these functions:

Option Explicit

Public support As String, length As Double, gamma As Double, x As Double, P As Double, phi As Double, xg As Double, xf As Double, fg As Double, gf As Double, Cp_0 As Double, Cp_1 As Double, Cp_2 As Double, Cp_3 As Double, Cp_4 As Double

Function pv(support, length, gamma, P, phi, x)
'Step Function Variables
xg = 0: xf = 0: gf = 0: fg = 0
If x > gamma Then
xg = 1
End If
If x > phi Then
xf = 1
End If
If gamma > phi Then
gf = gamma - phi
End If
If phi > gamma Then
fg = phi - gamma
End If
'Set Constants Of Integration
Cp_0 = 0: Cp_1 = 0: Cp_2 = 0
If support = "Pin-Pin-Free" Then
Cp_0 = (gf - fg - gamma) / gamma
Cp_1 = -1 - Cp_0
End If
'Calculate Shear
pv = -P * (xf + Cp_0 * xg + Cp_1)
End Function

Function pm(support, length, gamma, P, phi, x)
'Step Function Variables
xg = 0: xf = 0: gf = 0: fg = 0
If x > gamma Then
xg = x - gamma
End If
If x > phi Then
xf = x - phi
End If
If gamma > phi Then
gf = gamma - phi
End If
If phi > gamma Then
fg = phi - gamma
End If
'Set Constants Of Integration
Cp_0 = 0: Cp_1 = 0: Cp_2 = 0
If support = "Pin-Pin-Free" Then
Cp_0 = (gf - fg - gamma) / gamma
Cp_1 = -1 - Cp_0
End If
'Calculate Moment
pm = -P * (xf + Cp_0 * xg + Cp_1 * x + Cp_2)
End Function

Function pq(E, I, support, length, gamma, P, phi, x)
'Step Function Variables
xg = 0: xf = 0: gf = 0: fg = 0
If x > gamma Then
xg = x - gamma
End If
If x > phi Then
xf = x - phi
End If
If gamma > phi Then
gf = gamma - phi
End If
If phi > gamma Then
fg = phi - gamma
End If
'Set Constants Of Integration
Cp_0 = 0: Cp_1 = 0: Cp_2 = 0: Cp_3 = 0
If support = "Pin-Pin-Free" Then
Cp_0 = (gf - fg - gamma) / gamma
Cp_1 = -1 - Cp_0
Cp_3 = -(gf ^ 3 + Cp_1 * gamma ^ 3) / 6 / gamma
End If
'Calculate Slope
pq = -P / E / I * ((xf ^ 2 + Cp_0 * xg ^ 2 + Cp_1 * x ^ 2) / 2 + Cp_2 * x + Cp_3)
End Function

Function pd(E, I, support, length, gamma, P, phi, x)
'Step Function Variables
xg = 0: xf = 0: gf = 0: fg = 0
If x > gamma Then
xg = x - gamma
End If
If x > phi Then
xf = x - phi
End If
If gamma > phi Then
gf = gamma - phi
End If
If phi > gamma Then
fg = phi - gamma
End If
'Set Constants Of Integration
Cp_0 = 0: Cp_1 = 0: Cp_2 = 0: Cp_3 = 0: Cp_4 = 0
If support = "Pin-Pin-Free" Then
Cp_0 = (gf - fg - gamma) / gamma
Cp_1 = -1 - Cp_0
Cp_3 = -(gf ^ 3 + Cp_1 * gamma ^ 3) / 6 / gamma
End If
'Calculate Deflection
pd = -P / E / I * ((xf ^ 3 + Cp_0 * xg ^ 3 + Cp_1 * x ^ 3) / 6 + Cp_2 * x ^ 2 / 2 + Cp_3 * x + Cp_4)
End Function

Any ideas?

#### incajunk

##### New Member
That solved it. Thanks. Is there a simple alphabetical list somewhere of all the built-in functions?

#### xenou

##### MrExcel MVP, Moderator
Somewhere I think I have a link ... if I find it I'll post back. PV probably doesn't sound like a candidate VB function unless you are in finance! If you type VBA. (VBA dot) in the Visual Basic Editor you'll probably get a list. Although this may be something specific to vba in Excel-hosted applications here.
ξ

### Forum statistics

1,082,323
Messages
5,364,579
Members
400,809
Latest member
formulasataglance

### This Week's Hot Topics

• populate from drop list with multiple tables
Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
• Find list of words from sheet2 in sheet1 before a comma and extract text vba
Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
• Dynamic Formula entry - VBA code sought
Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...